SA-MP Forums Archive
Random car 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random car wanted level (/showthread.php?tid=91040)



Random car wanted level - SpawnZ - 12.08.2009

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


Re: Random car wanted level - James_Alex - 12.08.2009

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;
}



Re: Random car wanted level - SpawnZ - 12.08.2009

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.


Re: Random car wanted level - Yuryfury - 12.08.2009

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


Re: Random car wanted level - WrathOfGenesis - 12.08.2009

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.