Random car wanted level
#1

How would I make it so when a player enters a vehicle they have a 1 out of 5 chance to get wanted?
Thanks.
Reply
#2

try this
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
      new rLevel = random(5);
      switch(rLevel)
      {
        case 1:
        {
          SetPlayerWantedLevel(playerid, random(5));
        }
        case 2..4:
        {
       
        }
      }
    }
    return 1;
}
Reply
#3

Hmm, that's not working the way I wanted it to. Maybe I explained it wrong. I want it so when a player gets in a vehicle they have a 1 outta 5 chance to get a 1 star wanted level. Also would it be possible when the player gets in the vehicle and gets out and goes back in it doesn't do the random part of the script. Kinda hard to explain Anyways I appreciate the effort so far.
Reply
#4

just change the random(5) in the top script to 1

for the other 4 just return 1;

I don't follow you on the second part
Reply
#5

pawn Код:
public OnPlayerStateChange ( playerid , newstate , oldstate )
{
  if ( newstate == PLAYER_STATE_DRIVER )
  {
    if ( GetPlayerWantedLevel ( playerid ) == 0 )
    {
      if ( random ( 5 ) == 1 )
      {
        SetPlayerWantedLevel ( playerid , 1 );
      }
    }
  }
  return 1;
}
Untested but should work as you wanted.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)