Jump to content

Small problem


justn

Recommended Posts

How do i make, so if the player has 2 or more wanted level, then his wanted cant be set back to 1 ?

function onPlayerTarget ( theCop ) 
    local PoliceTeam = getTeamFromName ( "Police" ) 
    if ( PoliceTeam ) then 
    if getElementType ( theCop ) == "player" and getElementModel ( theCop ) == 280 then 
    setPlayerWantedLevel ( source, 1 ) 
end 
end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget ) 

Edited by Guest
Link to comment
function onPlayerTarget ( theCop ) 
    local PoliceTeam = getTeamFromName ( "Police" ) 
    if ( PoliceTeam ) then 
        if ( getElementType ( theCop ) == "player" and getElementModel ( theCop ) == 280 ) and ( getPlayerWantedLevel ( source ) == 0 ) then 
            setPlayerWantedLevel ( source, 1 ) 
        end 
    end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget ) 

By the way, why are you checking if the team exists? maybe you wanted to check if the player team was "Police"?

Link to comment
function onPlayerTarget ( theCop ) 
    local PoliceTeam = getTeamFromName ( "Police" ) 
    if ( PoliceTeam ) then 
        if ( getElementType ( theCop ) == "player" and getElementModel ( theCop ) == 280 ) and ( getPlayerWantedLevel ( source ) == 0 ) then 
            setPlayerWantedLevel ( source, 1 ) 
        end 
    end 
end 
addEventHandler ( "onPlayerTarget", getRootElement(), onPlayerTarget ) 

By the way, why are you checking if the team exists? maybe you wanted to check if the player team was "Police"?

Yeah dont worry , it's beta. i know i need to use isPlayerInTeam

Link to comment
And the problem is...?

when the police shots the player, then the player gets 2 wanted level, how to change so if player shoot police, then he gets 2 wanted levels?

function onPlayerDamage ( theCop ) 
    if isPlayerInTeam( theCop, "Police" ) then 
        if ( getElementType ( theCop ) == "player" and getElementModel ( theCop ) == 280 ) then 
        setPlayerWantedLevel ( source, 2 ) 
        end 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement(), onPlayerDamage ) 

Link to comment
function onPlayerDamage ( attacker ) 
    if isPlayerInTeam ( source, "Police" ) then 
        if ( getElementType ( attacker ) == "player" and getElementModel ( source ) == 280 ) then 
            setPlayerWantedLevel ( attacker, 2 ) 
        end 
    end 
end 
addEventHandler ( "onPlayerDamage", getRootElement(), onPlayerDamage ) 

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