Jump to content

Small problem


justn

Recommended Posts

Posted (edited)

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

Datastore - Store data to a database quickly. (Useful for saving scripted tables)

Posted

Well, you have to make your own healing function and check if the player's wanted level is more than 2 ( >= 2 ), then setElementHealth.

Posted
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"?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Datastore - Store data to a database quickly. (Useful for saving scripted tables)

Posted

Does it work as you wanted? or still having problems?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

And the problem is...?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

Datastore - Store data to a database quickly. (Useful for saving scripted tables)

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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