Jump to content

How to add skin ids to the grid list?


kewizzle

Recommended Posts

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
)

 

Link to comment

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
Link to comment
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
Link to comment
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
Link to comment

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...