Jump to content

wanted


SpikeRO3

Recommended Posts

Hello.

Yesterday i was making a script.

When a player has wanted level > 0 and is in a specific team a timer clear his wanted level.

But the script doesn't work, why?

function wan() 
local players = getElementsByType ( "player" ) 
for theKey,thePlayer in ipairs(players) do 
local police = getTeamName(thePlayer)  
local wanted = getPlayerWantedLevel(thePlayer) 
  
       if wanted > 0 and police == "San Andreas Police Department" then 
       setPlayerWantedLevel ( thePlayer, 0 ) 
       end 
        
end 
end 
  
setTimer(wan,100,0) 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), wan ) 

Link to comment

Try this:

function wan() 
    for theKey,thePlayer in ipairs(getElementsByType("player")) do 
        local theTeam = getPlayerTeam(thePlayer) 
        local wanted = getPlayerWantedLevel(thePlayer) 
        if wanted > 0 and theTeam == "San Andreas Police Department" then 
            setPlayerWantedLevel (thePlayer, 0) 
        end       
    end 
end 
setTimer(wan,100,0) 
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), wan ) 

Link to comment

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