TheIceman1 Posted March 14, 2013 Share Posted March 14, 2013 (edited) EDITED Edited March 14, 2013 by Guest Link to comment
PaiN^ Posted March 14, 2013 Share Posted March 14, 2013 The third argument of setElementDataisn't a string ! Link to comment
TheIceman1 Posted March 14, 2013 Author Share Posted March 14, 2013 EDITED Nothing happens. Link to comment
Renkon Posted March 14, 2013 Share Posted March 14, 2013 I will do it for you, seems u don't get it ^^ function setleaderplayer () if ( source == GUIEditor_Button[6] ) then if ( getElementData ( localPlayer, "leader" ) ) then local playerNamel = guiGridListGetItemText ( GUIEditor_Grid[2], guiGridListGetSelectedItem ( GUIEditor_Grid[2] ), 1 ) if ( playerNamel ) then triggerServerEvent ( "setleader",localPlayer, playerNamel) end end end end addEventHandler ( "onClientGUIClick", root, setleaderplayer ) addEvent ( "setleader", true ) function setleader (playerNamel) local playe = getPlayerFromName ( playerNamel ) if ( playe ) then setElementData ( playe, "leader", "leader" ) local acc = getPlayerAccount ( playe ) setAccountData ( acc, "Leader", getElementData ( playe, "leader" ) ) outputChatBox ( "You are promoted to Vice-Leader!", playe, 255, 255,0 ) end end addEventHandler ( "setleader", root, setleader ) Link to comment
TheIceman1 Posted March 14, 2013 Author Share Posted March 14, 2013 How can i solve it?I want when i press F3 then players are on grid list but when i click F3 again then it shows me this: function setplayers () local clan = getElementData ( localPlayer, "clan" ) for _, playeritems in ipairs ( getElementsByType ( "player" ) ) do local pclan = getElementData ( playeritems, "clan" ) if ( clan == pclan ) then local row = guiGridListAddRow ( GUIEditor_Grid[2] ) guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[2], getPlayerName( playeritems ), false, false ) if ( getElementData ( playeritems, "leader" ) ) then guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Leader", false, false ) else guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Member", false, false ) end end end end bindKey ( "F3", "down", setplayers ) Link to comment
iPrestege Posted March 14, 2013 Share Posted March 14, 2013 guiGridListClear ============== try this : function setplayers () guiGridListClear(GUIEditor_Grid[2]) local clan = getElementData ( localPlayer, "clan" ) for _, playeritems in ipairs ( getElementsByType ( "player" ) ) do local pclan = getElementData ( playeritems, "clan" ) if ( clan == pclan ) then local row = guiGridListAddRow ( GUIEditor_Grid[2] ) guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[2], getPlayerName( playeritems ), false, false ) if ( getElementData ( playeritems, "leader" ) ) then guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Leader", false, false ) else guiGridListSetItemText ( GUIEditor_Grid[2], row, GUIEditor_Column[3], "Member", false, false ) end end end end bindKey ( "F3", "down", setplayers ) 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