08.08.2011, 20:11
When the player do /heal and his ID he can heal himself how to disable that?
pawn Код:
new index;
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/heal", true) == 0)
{
if( gPlayerClass[playerid] != MEDIC ) return SendClientMessage(playerid, COLOR_RED, "You are not a Medic!");
new id;
tmp = strtok(cmdtext, index);
if (strlen(tmp))
{
id = strval(tmp);
if (IsPlayerConnected(id))
{
if(healedrec[playerid] != 1)
{
new Float:gX, Float:gY, Float:gZ;
GetPlayerPos(id, gX, gY, gZ);
if( IsPlayerInRangeOfPoint(playerid, 5.0, gX, gY, gZ) )
{
SetPlayerHealth(id, 99.0);
SendClientMessage(id, 0x00FF00AA, "You've been healed by a medic!");
SendClientMessage(playerid, 0x00FF00AA, "Player healed.");
SendClientMessage(playerid, COLOR_RED, "You may heal again in 15 seconds.");
healedrec[playerid] = 1;
SetTimerEx("HealAgain", 15000, 0, "i", playerid);
}else SendClientMessage(playerid, COLOR_RED, "You need to be near the player to heal him !");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You have healed a player recently!");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "USAGE: /heal <id>");
}
return 1;
}