Lower Wanted Level
#1

ello, im trying to make a lower wanted level timer. I have this, but it gives me theses errors and i dont know what is wrong. If you could help me i would really appreciate it. Thanks

Code :
Код:
public Lwanted()
{
  if(GetPlayerWantedLevel(playerid) > 1 && GetPlayerWantedLevel(playerid) < 6) // <---- line 448
  {
    SetPlayerWantedLevel(playerid, - 1); // <---- line 450
  }
}
Errors :
Код:
C:\***\gm.pwn(448) : error 017: undefined symbol "playerid"
C:\***\gm.pwn(450) : error 017: undefined symbol "playerid"
Reply
#2

Код:
public Lwanted()
Here's the problem, you have to put things you use for function (this time "playerid") in 2 places
1.
Код:
forward Lwanted(playerid);
2.
Код:
public Lwanted(playerid)
That's all, ou, and your function looks wrong to me...

I guess it should be:
Код:
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel-1);
PS:If you want to wanted level disapear "nowhere" then save it in variable!
Reply
#3

Thank you so, much. Now that you said that i slaped my self on the head. I totaly should have caught that! But again thanks.
Reply
#4

Quote:
Originally Posted by Kodman262
Thank you so, much. Now that you said that i slaped my self on the head. I totaly should have caught that! But again thanks.
Also could you show us your SetTimer? Because im 99% sure it will not work.
Reply
#5

pawn Код:
public LWantedLevel ( )
{
  for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ )
  {
    if ( IsPlayerConnected ( playerid ) )
    {
      if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 )
      {
        SetPlayerWantedLevel ( playerid , GetPlayerWantedLevel ( playerid ) - 1 );
      }
    }
  }
}
If you put this as your timer and it will work for all people with wanted levels. Saves making 200 timers if you have 200 players.
Reply
#6

Thank you, i was just about to post something because my level went up instead of down. xD Thanks gents
Reply
#7

Quote:
Originally Posted by WrathOfGenesis
pawn Код:
public LWantedLevel ( )
{
  for ( new playerid = 0; playerid < MAX_PLAYERS; playerid ++ )
  {
    if ( IsPlayerConnected ( playerid ) )
    {
      if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 )
      {
        SetPlayerWantedLevel ( playerid , GetPlayerWantedLevel ( playerid ) - 1 );
      }
    }
  }
}
If you put this as your timer and it will work for all people with wanted levels. Saves making 200 timers if you have 200 players.
I would make like this:
pawn Код:
public LWantedLevel ()
{
  for (new playerid = 0; playerid<MAX_PLAYERS; playerid++)
  {
    if (IsPlayerConnected(playerid))
    {
      if (GetPlayerWantedLevel(playerid)=>1 && GetPlayerWantedLevel(playerid)=<6)
      {
        SetPlayerWantedLevel (playerid,GetPlayerWantedLevel(playerid)-1);
      }
    }
  }
}
or it would ignore players with 1 and 6 wanted lvl :P
Reply
#8

Its exactly the same. I just have strange indentation and spacing habbits lol.
Reply
#9

Код:
if ( GetPlayerWantedLevel ( playerid ) > 1 && GetPlayerWantedLevel ( playerid ) < 6 )
Isn't the same as
Код:
if (GetPlayerWantedLevel(playerid)=>1 && GetPlayerWantedLevel(playerid)=<6)
(I didn't noticed this at start too )
Reply
#10

Ok this is kinda going off topic of the topic, but everytime i get in a car it gives me wanted stares. here is my code.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    poCar = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(poCar == poCar && gTeam[playerid] != TEAM_COP)
        {
            SetPlayerWantedLevel(playerid, 5);
            CheckWantedLevel(playerid);
        }
    }
    return 1;
}
pawn Код:
poCar = AddStaticVehicle(596,1536.1658,-1678.9585,13.2145,359.6118,13,13); // this one cop
pawn Код:
new poCar;
Again thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)