05.08.2013, 16:39
pawn Код:
RandomPlayerID()
{
new
RandomID[MAX_PLAYERS],
Players = 0;
for(new i=0; i != MAX_PLAYERS; i++)
if(IsPlayerConnected(i))
RandomID[Players++] = i;
if(!Players)
return INVALID_PLAYER_ID;
return RandomID[random(Players)];
}
new WinnerID = RandomPlayerID();
if(WinnerID != INVALID_PLAYER_ID)
{
GivePlayerWeapon(WinnerID,WeaponID,Ammo);
}