Jump to content

Wanted


Resmurf

Recommended Posts

Posted

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

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

Posted
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

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

Posted

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.

Posted

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.

Posted
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... :)

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