Eweest Posted July 19, 2015 Share Posted July 19, 2015 Hi guys! What's wrong here? Client: local skin = { {" Skin1" , 280 }, {" Skin2" , 281 } GUIEditor_GridList[30] = guiCreateGridList ( 0.01, 0.09, 0.5, 0.9, true, GUIEditor_Window[3] ) guiGridListSetSortingEnabled ( list, false ) GUIEditor_GridListAddColumn[30] = guiGridListAddColumn ( GUIEditor_GridList[30], "Название скина", 0.8 ) GUIEditor_GridListAddColumn[31] = guiGridListAddColumn ( GUIEditor_GridList[30], "ID", 0 ) for i, skin in ipairs (skin) do GUIEditor_teleRows[30] = guiGridListAddRow(GUIEditor_GridList[30]) GUIEditor_GridListSetItemText[30] = guiGridListSetItemText ( GUIEditor_GridList[30], GUIEditor_teleRows[30], 1, skin[1], false, false ) GUIEditor_GridListSetItemText[31] = guiGridListSetItemText ( GUIEditor_GridList[30], GUIEditor_teleRows[30], 2, skin[2], false, false ) end GUIEditor_Button[112] = guiCreateButton (350, 80, 140, 20, "set", false, GUIEditor_Window[3]) function spawnFreeSkin () if ( source == GUIEditor_Button[112] ) then local row,col = guiGridListGetSelectedItem(GUIEditor_GridList[30]) local mid = guiGridListGetItemText(GUIEditor_GridList[30],row,2) if ( row and col ) then triggerServerEvent("spawnskin",localPlayer,mid) end end end addEventHandler("onClientGUIClick",root,spawnFreeSkin) Server: Skin = {} function spawnskins(mid) if ( Skin[source] ) then setElementModel(Skin[source],mid) end end addEvent("spawnskin",true) addEventHandler("spawnskin",root,spawnskins) Link to comment
GTX Posted July 19, 2015 Share Posted July 19, 2015 Skin = {} function spawnskins(mid) if ( Skin[source] ) then setElementModel(source,tonumber(mid)) end end addEvent("spawnskin",true) addEventHandler("spawnskin",root,spawnskins) Link to comment
Eweest Posted July 21, 2015 Author Share Posted July 21, 2015 Skin = {} function spawnskins(mid) if ( Skin[source] ) then setElementModel(source,tonumber(mid)) end end addEvent("spawnskin",true) addEventHandler("spawnskin",root,spawnskins) don't works Link to comment
Perfect Posted July 21, 2015 Share Posted July 21, 2015 Try replacing 'root' with 'GUIEditor_Button[112]' inside the event 'onClientGuiClick' in client side. And also is there any errors in debugscript. Link to comment
GTX Posted July 21, 2015 Share Posted July 21, 2015 Is this the whole code? If so; function spawnskins(mid) setElementModel(source,tonumber(mid)) end addEvent("spawnskin",true) addEventHandler("spawnskin",root,spawnskins) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now