justn Posted March 18, 2014 Posted March 18, 2014 (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 March 18, 2014 by Guest Datastore - Store data to a database quickly. (Useful for saving scripted tables)
WhoAmI Posted March 18, 2014 Posted March 18, 2014 Well, you have to make your own healing function and check if the player's wanted level is more than 2 ( >= 2 ), then setElementHealth.
justn Posted March 18, 2014 Author Posted March 18, 2014 Oops, typo error: Health changed to wanted Datastore - Store data to a database quickly. (Useful for saving scripted tables)
Castillo Posted March 18, 2014 Posted March 18, 2014 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. Education is the most powerful weapon which you can use to change the world.
justn Posted March 18, 2014 Author Posted March 18, 2014 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)
Castillo Posted March 18, 2014 Posted March 18, 2014 Does it work as you wanted? or still having problems? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
justn Posted March 18, 2014 Author Posted March 18, 2014 Still have problems, i dont get any errors in debugscript though. Datastore - Store data to a database quickly. (Useful for saving scripted tables)
Castillo Posted March 18, 2014 Posted March 18, 2014 And the problem is...? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
justn Posted March 18, 2014 Author Posted March 18, 2014 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)
Castillo Posted March 19, 2014 Posted March 19, 2014 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. Education is the most powerful weapon which you can use to change the world.
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