Derpy Posted August 23, 2014 Share Posted August 23, 2014 example function health(thePlayer) local ppHealth = getElementHealth(thePlayer) setElementHealth(thePlayer,ppHealth + 2) end how do i define thePlayer in here?? it always returns nil Link to comment
lcd12321 Posted August 23, 2014 Share Posted August 23, 2014 if clientside getlocalplayer else see events Link to comment
Anubhav Posted August 23, 2014 Share Posted August 23, 2014 -- if server sided function health(thePlayer) local ppHealth = getElementHealth(thePlayer) setElementHealth(thePlayer,ppHealth + 2) end addCommandHandler("health", health) -- if client sided function health() local ppHealth = getElementHealth(localPlayer) setElementHealth(localPlayer,ppHealth + 2) end Link to comment
Derpy Posted August 23, 2014 Author Share Posted August 23, 2014 oh i forgot to mention: i am trying to work on this in server side because in client i already know how to make it but server side is better @Anubhav isn't there any other way? im activating that function with a timer, so i must use executeCommandHandler always to force players do something? Link to comment
Anubhav Posted August 23, 2014 Share Posted August 23, 2014 Add me at skype, we'll see. anubhav.agarwal87 Link to comment
Derpy Posted August 23, 2014 Author Share Posted August 23, 2014 i dont have skype i just want to know how can i define player,vehicle or whatever(any element) without using handlers (im triggering those functions e.g like this) blabla() Link to comment
albers14 Posted August 23, 2014 Share Posted August 23, 2014 Is thePlayer a string or a player element? And how are you going to use it? Uhm and why is server better than client? Link to comment
Derpy Posted August 23, 2014 Author Share Posted August 23, 2014 its an element as i stated above. i usually use it for setting specific datas, i will give you an example when player joins, source is the player who joined if i set a timer for another function to output message to that player who joined, in that another function, source will be nil and i would like to be able to retrieve player whenever i want without any handler Link to comment
Derpy Posted August 23, 2014 Author Share Posted August 23, 2014 ugh nobody helped me -.- i have used a loop and it works fine now 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