SA-MP Forums Archive
Wanted Level - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Wanted Level (/showthread.php?tid=577307)



Wanted Level - STONEGOLD - 10.06.2015

OKay, I'm using this:

I'm using this on "OnPlayerUpdate"
PHP Code:
if (GetPlayerWantedLevel(playerid) > 6)
    {
      
SetPlayerWantedLevel(playerid6);
    } 
But

PHP Code:
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + 4);
                 
format(stringsizeof(string), "Store Robbery - Wanted Level %d - Red"GetPlayerWantedLevel(playerid)); 
PHP Code:
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + 5);
                 
format(stringsizeof(string), "Store Robbery - Wanted Level %d - Red"GetPlayerWantedLevel(playerid)); 
I want Set wanted level max 6 . I don't want it shows me like this .


Store Robbery - Wanted Level 8 - Red
Store Robbery - Wanted Level 12 - Red

I want if player has 6 wanted levle stars and rob a store so it still should send msg to player like this

Store Robbery - Wanted Level 6 - Red

Not

Store Robbery - Wanted Level 8 - Red

. I want set max wanted levle to 6. I don't want it goes up.

Anyone help me?


Re: Wanted Level - Ghazal - 10.06.2015

Change
pawn Code:
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + 4);
                 format(string, sizeof(string), "Store Robbery - Wanted Level %d - Red", GetPlayerWantedLevel(playerid));
to

pawn Code:
if(GetPlayerWantedLevel(playerid) > 2)
          {
               SetPlayerWantedLevel(playerid, 6 );
          }
          else
          {
            SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + 4);    
          }
and so on.


Re: Wanted Level - STONEGOLD - 10.06.2015

I want set my max wanted level to 6 so it always show me 6 not 8 or 9 or 10 or whatever. Even if player has 6 and he rob a store he should get 4 stars but it should says;

Store Robbery - Wanted Level 6 - Red


Re: Wanted Level - DarkLouis - 10.06.2015

Puah!

It's just:

PHP Code:

SetPlayerWantedLevel
(playeridGetPlayerWantedLevel(playerid) + 4);
 
if(
GetPlayerWantedLevel(playerid) > 6SetPlayerWantedLevel(playerid6); 
format(stringsizeof(string), "Store Robbery - Wanted Level %d - Red"GetPlayerWantedLevel(playerid)); 



Re: Wanted Level - KamalBa - 10.06.2015

Can you please give me your code I want to make a wanted level for criminals which they can had 400 or 1000 stars if the cops can't catch them...

And if a cop killed him he will be jailed for a long time sometimes more than 10mins

So anyone can help out ?


Re: Wanted Level - DarkLouis - 10.06.2015

400, 1000 stars? What?

.. Give me your skype's contact.


Re: Wanted Level - KamalBa - 10.06.2015

Speers23 From Israel


Re: Wanted Level - Vince - 10.06.2015

OnPlayerUpdate is not meant to cover up shoddy coding practices. Create your own wanted level wrapper like this:

PHP Code:
IncreasePlayerWantedLevel(playeridlevelIncrease)
{
    
SetPlayerWantedLevel(playeridclamp((GetPlayerWantedLevel(playerid) + levelIncrease), 06))

The clamp function forces a value in range, so in this case it sets it to 0 if it's less than that and to 6 if it's more than that.


Re: Wanted Level - STONEGOLD - 10.06.2015

Quote:
Originally Posted by Vince
View Post
OnPlayerUpdate is not meant to cover up shoddy coding practices. Create your own wanted level wrapper like this:

PHP Code:
IncreasePlayerWantedLevel(playeridlevelIncrease)
{
    
SetPlayerWantedLevel(playeridclamp((GetPlayerWantedLevel(playerid) + levelIncrease), 06))

The clamp function forces a value in range, so in this case it sets it to 0 if it's less than that and to 6 if it's more than that.
Thanks, Explain more. I'm new so. I mean, where should i add this ^^?


Re: Wanted Level - Banana_Ghost - 11.06.2015

Quote:
Originally Posted by STONEGOLD
View Post
Thanks, Explain more. I'm new so. I mean, where should i add this ^^?
place it anywhere in your script that's not in a callback.
Anywhere you increase a player's wanted level, replace it with
PHP Code:
IncreasePlayerWantedLevel(playeridlevelIncrease