LasHa Posted June 7, 2014 Share Posted June 7, 2014 guys i am new scripter and i am going to make great script just a problem that i have got. i want to set element data like this one, when player click button, setelementdata playersJoined and when second player hits in this button, it adds in the same elementdata playersJoined but +1 and when player leave game or write /cansel maybe -1? but how? i don't know anything in datas and in wiki i didn't understand what to do because there are not things like i want please help me :( Link to comment
'LinKin Posted June 7, 2014 Share Posted June 7, 2014 What? When a player clicks a button.. hm Use this: onClientGUIClick: setElementData(localPlayer, "yourDataKey", true) .. This is what I understand.. And btw, when a player quits the server all his elementData gets lost, for the /cansel thing, maybe you can do setElementData(localPlayer, "yourDataKey", nil) You should explain more what you're trying to do. It's really hard to help if you don't put some effort to make your post be understandable. Link to comment
Cadell Posted June 7, 2014 Share Posted June 7, 2014 Use this i think it will help you function JoinCounter() if not getElementData(localPlayer,"YouR_Data") then setElementData(localPlayer,"Your_data",0) end end addEventHandler("onClientPlayerJoin", getRootElement(), JoinCounter) function initGUI( ) --make your gui here local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count+1) end addEventHandler ( "onClientGUIClick", btnOutput, intiGUI ) function onQuitGame( ) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"YOur_Data",count-1) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) I also suggest you to set player account data on quit so when it come back and click count wont get abuse. I think that what you need if no then please explain some more about your idea. Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 thanks very mcuh cadell you understood what i wanted. Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 its server side or client? Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 its server side or client? Cant you see onClientPlayerQuit Because there is client , gui functions , client , so it's clientSide , 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