23.05.2014, 23:16
Hey, I have a command for medic */cure* which heals team mates. The problem that it don't heal the other player it heals the medic him self. and i want to add that the medic can't heal him self. +rep for who will help me 

Код:
CMD:cure(playerid, params[])
{
new gid;
if(sscanf(params, "u", gid))
{
SendClientMessage(playerid, -1, "usage: /cure <playerid/name>");
return true;
}
if(gid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1, "Invalid playerid!");
new Float:x, Float:y, Float:z;
GetPlayerPos(gid, x, y, z);
new rangepoint = IsPlayerInRangeOfPoint(playerid, 5,x,y,z);
if(!rangepoint)
{
return SendClientMessage(playerid, -1, "The player is not near you!");
}
if(rangepoint)
{
if(gTeam[gid] == gTeam[playerid])
{
if(gClass[playerid] == MEDIC)
{
SetTimerEx("cure", 7000, false, "i", playerid);
SendClientMessage(playerid, 0x1DE6F5FF, "Player is being cured!");
SendClientMessage(gid, 0x1DE6F5FF, "Curing..");
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 1, 1, 1, 1, 1);
}
if(gClass[playerid] != MEDIC)
{
SendClientMessage(playerid, red, "Only Medic Class can cure!");
}
}
if(gTeam[gid] != gTeam[playerid])
{
SendClientMessage(playerid, red, "You can only cure team mates!");
}
}
return true;
}
//==============================================================================
forward cure(playerid);
public cure(playerid)
{
new gid;
SetPlayerHealth(gid, 1000);
new str[128];
format(str, sizeof(str),"Medic: {FF00FF}%s {00FF00}has cured his team mate and earned {FFFF00}+2 Score , +500$", pName(playerid), GetTeamName(playerid));
SendClientMessageToAll(0x11ED48FF, str);
GivePlayerScore(playerid, 2);
GivePlayerMoney(playerid, 500);
return 1;
}

