SA-MP Forums Archive
RandomPlayeriID - 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: RandomPlayeriID (/showthread.php?tid=92678)



RandomPlayeriID - user226 - 21.08.2009

Hello all !
how to make, to the server every 5 minutes random worked on player.
For example, to every 5 minutes, Random Player is given a pistol?

p sorry, i could find code in search, but i bad know English Language.
Help me please


Re: RandomPlayeriID - woot - 21.08.2009

This might work, I'm not sure though, cannot guarantee you anything.
Edit the "random(201)" to your playerslots+1, examply your server has 51 slots, then set it to random(51);

pawn Код:
forward RandomPlayer();
public RandomPlayer()
{
    new randomplayer = random(201);
    if(!IsPlayerConnected(randomplayer)) return RandomPlayer();
    else
    {
      GivePlayerWeapon(randomplayer, 38, 5000);
      return 1;
    }
}



Re: RandomPlayeriID - user226 - 21.08.2009

are else options?


Re: RandomPlayeriID - user226 - 21.08.2009

Quote:
Originally Posted by //exora
This might work, I'm not sure though, cannot guarantee you anything.
Edit the "random(201)" to your playerslots+1, examply your server has 51 slots, then set it to random(51);

pawn Код:
forward RandomPlayer();
public RandomPlayer()
{
    new randomplayer = random(201);
    if(!IsPlayerConnected(randomplayer)) return RandomPlayer();
    else
    {
      GivePlayerWeapon(randomplayer, 38, 5000);
      return 1;
    }
}
Do not working... ;((
Help me please


Re: RandomPlayeriID - dice7 - 21.08.2009

Add
pawn Код:
SetTimer("RandomPlayer", 300000, true);
under OnGameModeInit


Re: RandomPlayeriID - user226 - 21.08.2009

Quote:
Originally Posted by dice7
Add
pawn Код:
SetTimer("RandomPlayer", 300000, true);
under OnGameModeInit
I know that need to start public, I did a timer and not only, not work(


Re: RandomPlayeriID - user226 - 22.08.2009

up