04.02.2010, 10:53
I have this heal code:
And i want to add:
Where abouts in that code would i put that?
Because i tried putting it in a few places,
But it heals me, Sends me the messages, But also sends that message,
I want it to check that if im trying to heal myself,
It sends me a message and dosent do anything,
If im not, it carys on...
pawn Код:
dcmd_heal(playerid, params[])
{
if(GetPlayerTeam(playerid) == 2)
{
if (strlen(params))
{
new id = strval(params);
if (IsPlayerConnected(id))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 6.0, x, y, z))
{
SetPlayerHealth(id, 100.0);
new name[MAX_PLAYER_NAME], string[48];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Medical Member %s has healed you.", name );
SendClientMessage(id, 0xFF8040FF, string);
new name1[MAX_PLAYER_NAME];
GetPlayerName(id, name1, sizeof(name1));
format(string, sizeof(string), "You have healed %s", name1);
SendClientMessage(playerid, 0xFF8040FF, string);
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You're not near this player");
}
//}
//else
//{
//SendClientMessage(playerid, 0xFF0000AA, "You cannot heal yourself");
//}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Player not found");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Usage: /heal (PlayerID/PartOfName) ");
}
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "You need to be part of the Medical Team to use this command");
}
return 1;
}
pawn Код:
if(id == playerid)
Because i tried putting it in a few places,
But it heals me, Sends me the messages, But also sends that message,
I want it to check that if im trying to heal myself,
It sends me a message and dosent do anything,
If im not, it carys on...