14.11.2010, 23:33
pawn Код:
stock GetRandomID()
{
new rand, count = 0;
do
{
rand = random(MAX_PLAYERS);
count++;
}
while(!IsPlayerConnected(rand) && count < MAX_PLAYERS);
if(count >= MAX_PLAYERS) return INVALID_PLAYER_ID;
else
return rand;
}
Use this:
pawn Код:
public Infected(playerid = GetRandomID())
{
ResetPlayerWeapons(playerid);
SetPlayerColor(playerid,Z_COLOR);
SetPlayerTeam(playerid,TEAM_ZOMBIE);
SetPlayerHealth(playerid,50);
SetPlayerWeather(playerid,32);
SetPlayerTime(playerid,24,0);
new name[MAX_PLAYER_NAME], string4[256];
GetPlayerName(playerid, name, sizeof(name));
format(string4, sizeof(string4), "Player %s has just been infected turned into [Zombie]",name);
SendClientMessageToAll(COLOR_RED,string4);
GameTextForPlayer(playerid,"~r~ YOU JUST BEEN ZOMBIFIED INTO INFECTED SIDE",6000,4);
new skin = random(4);
switch(skin)
{
case 0:SetPlayerSkin(playerid,Z_SKIN2);
case 1:SetPlayerSkin(playerid,Z_SKIN);
case 2:SetPlayerSkin(playerid,137);
}
return 1;
}