13.05.2011, 15:59
Whole command.
Not Tested
Not Tested
pawn Код:
new InfectedTimer[MAX_PLAYERS];
COMMAND:infect(playerid, params[])
{
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "USAGE: /infect [playeris | name]");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFAA, "That player is not connected");
{
InfectedTimer[playerid] = SetTimerEx("Infected", 1000, true, "d", targetid);
SendClientMessage(playerid, 0xFFFFFFAA, "You infected someone");
SendClientMessage(targetid, 0xFFFFFFAA, "Someone infected you");
}
return 1;
}
forward Infected(playerid);
public Infected(playerid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Health >= 5)
{
SetPlayerHealth(playerid, Health - 5);
}
else
{
SetPlayerHealth(playerid, 0.0);
KillTimer(InfectedTimer[playerid]);
SendClientMessageToAll(0xFFFFFFAA, "Someone died of a infection");
}
return 1;
}