Jump to content

[Help] setElementData


LasHa

Recommended Posts

Posted

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? :(:S 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 :(:(

Posted

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.

Need a clanwar script? Click here!

Do you want some free scripts for your DD server? Visit my website.

Posted

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.

Script Trading Status

Successful Trading : 26

Scam : 0

On Sale : Banking System SQL Based

On Sale : Housing System MySQL Based

Download and Support my new script on Community : http://community.mtasa.com/index.php?p=resources&s=details&id=11686

SQL Based Housing

Posted
its server side or client?

Cant you see

onClientPlayerQuit

Because there is client , gui functions , client , so it's clientSide ,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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