10.09.2017, 16:22
Trying to make a command where if the victim his health is >40 it sets it to 60 but its not working.
What am I doing wrong?
Thanks in advance.
What am I doing wrong?
Thanks in advance.
PHP код:
CMD:healup(playerid, params[])
{
new victim, health;
new Float:X, Float:Y, Float:Z;
GetPlayerPos(victim, X, Y, Z);
if(PlayerInfo[playerid][pFaction] != 3) return SCM(playerid, COLOR_LIGHTRED, "You are not a police officer.");
if(sscanf(params, "ud", victim)) return SendClientMessage(playerid, COLOR_GREY, "/healup (id)");
if(victim == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_LIGHTRED, "That player is not connected.");
if (GetDistanceBetweenPlayers(playerid,victim) < 5)
{
GetPlayerHealth(victim, health);
if (health < 40)
SetPlayerHealth(victim, 60);
}
else return SCM(playerid, COLOR_LIGHTRED, "You're not close to that player.");
return 1;
}