pawn Код:
// top of script
new OfferedHeal[MAX_PLAYERS];
new HealthPrice;
new MedicID, PatientID;
new healedname[24], medicname[24];
// new heal command
CMD:heal(playerid, params[])
{
if(PlayerInfo[playerid][Job] == 1)
{
new string[128];
if(sscanf(params, "ii", PatientID, HealthPrice)) return SendClientMessage(playerid, -1,"/heal [PlayerID/PlayerName] [Amount]"); // This will actually do it - I is a interget and that's a targetid.
GetPlayerName(PatientID,healedname,24);
GetPlayerName(MedicID,medicname,24);
if(GetPlayerHealth(PatientID) <= 99)
{
format(string,128,"Medic %s (%d) Has Offered You Health Services For $%d. Type /acceptheal To Accept.",medicname,MedicID,HealthPrice);
SendClientMessage(PatientID,-1,string);
format(string,128,"Offered %s (%d) Health Services For $%d. Wait To See If He Will Respond.",healedname,PatientID,HealthPrice);
SendClientMessage(MedicID,-1,string);
OfferedHeal[PatientID] = 1;
} else return SendClientMessage(MedicID,-1,"The Target Player's Health Is Already Full.");
} else return SendClientMessage(MedicID, 0xFFFFFFFF, ".:: Error: You need to be a m3dic to use this command! ::.");
return 1;
}
// /acceptheal command
CMD:acceptheal(playerid,params[])
{
if(OfferedHeal[PatientID] == 1)
{
new string[128];
SetPlayerHealth(PatientID,100);
format(string,128,"Healed By Medic %s (%d) For $%d.",medicname,MedicID,HealthPrice);
SendClientMessage(PatientID,-1,string);
format(string,128,"Healed %s (%d) For $%d.",healedname,PatientID,HealthPrice);
SendClientMessage(PatientID,-1,string);
GivePlayerMoney(PatientID, -HealthPrice);
GivePlayerMoney(MedicID, HealthPrice);
OfferedHealth[PatientID] = 0;
} else return SendClientMessage(PatientID,-1,"You Weren't Offered Any Medic Services.");
return 1;
}