Wanted Level
#1

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?
Reply
#2

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.
Reply
#3

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
Reply
#4

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)); 
Reply
#5

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 ?
Reply
#6

400, 1000 stars? What?

.. Give me your skype's contact.
Reply
#7

Speers23 From Israel
Reply
#8

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.
Reply
#9

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 ^^?
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)