Jump to content

How to add skin ids to the grid list?


kewizzle

Recommended Posts

Posted

heres my source, idk how to add the skin ids next to it.

shinshop = createMarker(-673, 916.4, 11,"cylinder",2.0,0,255,0,255)
		local Skins = { 
  { "CJ", 0 }, 
  { "Hippie", 1 }, 
  { "Division Sheild", 17 }, 
  { "Division fumigator", 18 }, 
  { "Division incinerator", 19 }, 
  { "Rich Woman", 55 }, 
  { "Tall Balla", 104 },
}   

addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        skinwindow = guiCreateWindow((screenW - 527) / 2, (screenH - 608) / 2, 527, 608, "Kewizzle's Skin Shop", false)
        guiWindowSetSizable(skinwindow, false)
        guiSetProperty(skinwindow, "CaptionColour", "FFDDEA14")
		guiSetVisible( skinwindow, not guiGetVisible( skinwindow ) )
        skinselect = guiCreateGridList(99, 29, 324, 490, false, skinwindow)
        guiGridListAddColumn(skinselect, "Skin Name", 0.5)
        guiGridListAddColumn(skinselect, "Skin ID", 0.5)
        purchase = guiCreateButton(99, 529, 155, 61, "Buy Skin $500", false, skinwindow)
        guiSetFont(purchase, "default-bold-small")
        guiSetProperty(purchase, "NormalTextColour", "FF00F940")
        cancelbuy = guiCreateButton(269, 529, 154, 61, "Cancel", false, skinwindow)
        guiSetFont(cancelbuy, "default-bold-small")
        guiSetProperty(cancelbuy, "NormalTextColour", "FFF90000")    
		addEventHandler("onClientGUIClick", cancelbuy, CloseWindow)
		
addEventHandler("onClientGUIClick", purchase, function()
	   local Select = tonumber( guiGridListGetItemData( skinselect, guiGridListGetSelectedItem( skinselect ), 1 ) ) 
       if ( Select and Select ~= '' ) then 
       triggerServerEvent( "setClientSkin", localPlayer, tonumber( guiGridListGetItemData( skinselect, guiGridListGetSelectedItem( skinselect ), 1 ) ) ) 
    CloseWindow()
	end
end)
		
		for _,v in ipairs( Skins ) do 
		   local Row = guiGridListAddRow( skinselect ) 
		   guiGridListSetItemText( skinselect, Row, 1, v[1], false, false ) 
		   guiGridListSetItemData( skinselect, Row, 1, v[2] ) 
		end 
    end
)

 

MTA:SA Scripting Is Fun!

spacer.png

Posted (edited)

try it

shinshop = createMarker(-673, 916.4, 11,"cylinder",2.0,0,255,0,255)
		local Skins = { 
  { "CJ", 0 }, 
  { "Hippie", 1 }, 
  { "Division Sheild", 17 }, 
  { "Division fumigator", 18 }, 
  { "Division incinerator", 19 }, 
  { "Rich Woman", 55 }, 
  { "Tall Balla", 104 },
}   

addEventHandler("onClientResourceStart", resourceRoot,
    function()
local screenW, screenH = guiGetScreenSize()
        skinwindow = guiCreateWindow((screenW - 527) / 2, (screenH - 608) / 2, 527, 608, "Kewizzle's Skin Shop", false)
        guiWindowSetSizable(skinwindow, false)
        guiSetProperty(skinwindow, "CaptionColour", "FFDDEA14")
		guiSetVisible( skinwindow, not guiGetVisible( skinwindow ) )
        skinselect = guiCreateGridList(99, 29, 324, 490, false, skinwindow)
        guiGridListAddColumn(skinselect, "Skin Name", 0.5)
        guiGridListAddColumn(skinselect, "Skin ID", 0.5)
        purchase = guiCreateButton(99, 529, 155, 61, "Buy Skin $500", false, skinwindow)
        guiSetFont(purchase, "default-bold-small")
        guiSetProperty(purchase, "NormalTextColour", "FF00F940")
        cancelbuy = guiCreateButton(269, 529, 154, 61, "Cancel", false, skinwindow)
        guiSetFont(cancelbuy, "default-bold-small")
        guiSetProperty(cancelbuy, "NormalTextColour", "FFF90000")    
		addEventHandler("onClientGUIClick", cancelbuy, CloseWindow)
		
addEventHandler("onClientGUIClick", purchase, function()
	   local Select = tonumber( guiGridListGetItemData( skinselect, guiGridListGetSelectedItem( skinselect ), 1 ) ) 
       if ( Select and Select ~= '' ) then 
       triggerServerEvent( "setClientSkin", localPlayer, tonumber( guiGridListGetItemData( skinselect, guiGridListGetSelectedItem( skinselect ), 1 ) ) ) 
    CloseWindow()
	end
end)
		
		for _,v in ipairs( Skins ) do 
		   local Row = guiGridListAddRow( skinselect ) 
		   guiGridListSetItemText( skinselect, Row, 1, v[1], false, false ) 
      		   guiGridListSetItemText( skinselect, Row, 2, v[2], false, false ) 

		   guiGridListSetItemData( skinselect, Row, 1, v[2] ) 
		end 
    end
)

you must create 2 columns in grid list

Edited by Master_MTA
  • Like 1

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
1 minute ago, kewizzle said:

thanks guys im learning so much lol.

any time my brother study hard xD

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
1 hour ago, Master_MTA said:

any time my brother study hard xD

i see what you did

 

guiGridListSetItemData( skinselect, Row, 1, v[2] )  would mean to get the Item data in the table skins and place it in the second column in each row according to the skin in the table. 

  • Like 1

MTA:SA Scripting Is Fun!

spacer.png

Posted
1 minute ago, kewizzle said:

i see what you did

 

guiGridListSetItemData( skinselect, Row, 1, v[2] )  would mean to get the Item data in the table skins and place it in the second column in each row according to the skin in the table. 

no you mean guiGridListSetItemText

if you wanna use guiGridListSetItemData you should know something about guiGridListGetItemData  the function

guiGridListSetItemData  used for set data on the item wich you just created it with guiGridListAddRow in the loop so the difference between guiGridListSetItemData 

and guiGridListSetItemText

is the visible the function guiGridListSetItemText is visible you can see it but the function guiGridListSetItemData  is invisible it's look like  setElementData

i hope u understood me +_+

 

  • Like 1

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
1 hour ago, Master_MTA said:

no you mean guiGridListSetItemText

if you wanna use guiGridListSetItemData you should know something about guiGridListGetItemData  the function

guiGridListSetItemData  used for set data on the item wich you just created it with guiGridListAddRow in the loop so the difference between guiGridListSetItemData 

and guiGridListSetItemText

is the visible the function guiGridListSetItemText is visible you can see it but the function guiGridListSetItemData  is invisible it's look like  setElementData

i hope u understood me +_+

 

thanks for that lovely info

  • Like 1

MTA:SA Scripting Is Fun!

spacer.png

Posted
Just now, kewizzle said:

thanks for that lovely info

any time +_+

  • Like 1

Skype 01100001 01101100 01101001 01011111 01101101 01110100 00110001 00111001 00111001 00111001

every thing is gonna be alright

every thing is gonna be okay

it's gonna be a good good life

that's what my therapist say

Posted
4 hours ago, Master_MTA said:

any time +_+

God bless Google translate ;>

 

721195519.png

595770773.png

 

76561198277320954.pngAddFriend.png

خلك احسن من غيرك,

لا تقول عندهم اشياء ماهي عندي

انت عندك اشياء ماهي عند غيرك #

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...