22.07.2010, 19:14
I believe that it won't work so well,since the size of MAX_PLAYERS is 200 or 500.And if there's one player in the server the chances that he will be chosen are very small. You can check how much players are online and then randomize between them and give one of them money.
Some thing like this:
Some thing like this:
pawn Код:
//Top of script
forward RandMoney();
new Players;
public OnGameModeInit()
{
SetTimer("RandMoney,300000,1);
return 1;
}
public OnPlayerConnect(playerid)
{
Players++; //Adds one player to the variable every time a player joins
return 1;
}
public OnPlayerDisconnect(playerid)
{
Players--; //Exactly the same as above but the opposite way.
return 1;
}
public RandMoney()
{
GivePlayerMoney(random(Players),3000);
}