justn Posted March 18, 2014 Share 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 Link to comment
WhoAmI Posted March 18, 2014 Share 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. Link to comment
justn Posted March 18, 2014 Author Share Posted March 18, 2014 Oops, typo error: Health changed to wanted Link to comment
Castillo Posted March 18, 2014 Share 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"? Link to comment
justn Posted March 18, 2014 Author Share 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 Link to comment
Castillo Posted March 18, 2014 Share Posted March 18, 2014 Does it work as you wanted? or still having problems? Link to comment
justn Posted March 18, 2014 Author Share Posted March 18, 2014 Still have problems, i dont get any errors in debugscript though. Link to comment
justn Posted March 18, 2014 Author Share 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 ) Link to comment
Castillo Posted March 19, 2014 Share 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 ) Link to comment
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