05.03.2011, 13:43
Hi. I made a heal command but it heals only me even if i tipe /aheal 3 and i have id 3 online still i get healed and he doesn't. Here is my code :
pawn Код:
if(strcmp(cmd, "/aheal", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /aheal [playerid]");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
// GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 102)
{
new Float:tempheal;
GetPlayerHealth(giveplayerid,tempheal);
SetPlayerHealth(giveplayerid, 100);
SetPlayerArmour(playerid,100);
PlayerPlaySound(giveplayerid, 1052, 0.0, 0.0, 0.0);
{
format(string, sizeof(string), "Server : %s Has been healed by admin %s.", PlayerName[giveplayerid], PlayerName[playerid]);
SendClientMessageToAll(COLOR_RED, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command !");
return 1;
}
}
}
else
{
format(string, sizeof(string), "That player is offline.", giveplayerid);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
return 1;
}