24.05.2014, 00:29
pawn Код:
forward cure(playerid, cureid);
public cure(playerid, cureid)
{
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(0x11ED4800, str);
GivePlayerScore(playerid, 2);
GivePlayerMoney(playerid, 500);
SetPlayerHealth(cureid, 100.0);
return 1;
}
CMD:cure(playerid, params[])
{
new gid;
if(gClass[playerid] != MEDIC) SendClientMessage(playerid, red, "Only Medic Class can cure!");
else if(sscanf(params, "u", gid)) SendClientMessage(playerid, -1, "usage: /cure <playerid/name>");
else if(gid == INVALID_PLAYER_ID) SendClientMessage(playerid, -1, "Invalid playerid!");
else if(gTeam[gid] != gTeam[playerid]) SendClientMessage(playerid, red, "You can only cure team mates!");
else{
new Float:x, Float:y, Float:z;
GetPlayerPos(gid, x, y, z);
if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z)) SendClientMessage(playerid, -1, "The player is not near you!");
else{
SetTimerEx("cure", 7000, false, "ii", playerid, gid); // medic and cured
SendClientMessage(playerid, 0x1DE6F5FF, "Player is being cured!");
SendClientMessage(gid, 0x1DE6F5FF, "Curing..");
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.1, 0, 1, 1, 1, 1, 1);
}
}
return true;
}