Resmurf Posted June 19, 2011 Share Posted June 19, 2011 i tried making Online sesion and total online time and wanted stars but i just tried with wanted and got a error ;S local starttick, currenttick local player = getLocalPlayer() addEventHandler("onClientRender",getRootElement(), function() if not starttick then starttick = getTickCount() end currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"Wanted",getPlayerWantedLevel( player ) ) starttick = getTickCount() end end ) function updatestars() for k, v in ipairs(getElementsByType('player')) do local Wanted = getPlayerWantedLevel(v) setElementData(v,"Wanted",star ) end end setTimer(updatestars, 1000000, 0) Help please Link to comment
JR10 Posted June 19, 2011 Share Posted June 19, 2011 setElementData(v,"Wanted",star ) Where is star defined? Link to comment
JR10 Posted June 19, 2011 Share Posted June 19, 2011 Dude lol, i said it's not defined can you read? you should define it i didn't fix anything Link to comment
gokalpfirat Posted June 19, 2011 Share Posted June 19, 2011 # function updatestars() for k, v in ipairs(getElementsByType('player')) do local star = getPlayerWantedLevel(v) setElementData(v,"Wanted",star ) end end setTimer(updatestars, 1000000, 0) Use this. Link to comment
Resmurf Posted June 19, 2011 Author Share Posted June 19, 2011 Dude lol, i said it's not defined can you read? you should define it i didn't fix anything I know what u meant, i wrote on wrong thread Link to comment
gokalpfirat Posted June 19, 2011 Share Posted June 19, 2011 # function updatestars() for k, v in ipairs(getElementsByType('player')) do local star = getPlayerWantedLevel(v) setElementData(v,"Wanted",star ) end end setTimer(updatestars, 1000000, 0) Use this. I think this will working and you defined WantedLevel to local Wanted but you should defined it local star then it works. Link to comment
Kenix Posted June 19, 2011 Share Posted June 19, 2011 getPlayerWantedLevel is server side function use this for call function : https://wiki.multitheftauto.com/wiki/CallServerFunction Link to comment
DiSaMe Posted June 19, 2011 Share Posted June 19, 2011 callServerFunction won't help. It doesn't return any value, so calling getPlayerWantedLevel in such way is useless. Just make a server-side script for setting element data value to wanted level. That's the easiest and the most efficient way. Link to comment
eAi Posted June 20, 2011 Share Posted June 20, 2011 We generally recommend doing as much as possible server-side anyway. You reduce the risk of cheaters, you aren't giving away your code, and you reduce the strain on clients. Link to comment
will briggs Posted June 20, 2011 Share Posted June 20, 2011 We generally recommend doing as much as possible server-side anyway. You reduce the risk of cheaters, you aren't giving away your code, and you reduce the strain on clients. Yeah and just use trigger client event or call client... 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