15.12.2016, 07:10
Good
CMD:heal(playerid, params[]) { if(dm[playerid] == 1) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You Are in a Deathmatch. Type /leavedm to Use this Command."); } if(class[playerid] != 2) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You Need to be Doctor to Use This Command."); } new targetid; if (sscanf(params, "u", targetid)) { return SendClientMessage(playerid, -1, "{FF0000}Syntax: {FFFFFF}/heal (playerid / Name)"); } if(!IsPlayerConnected(targetid)) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}The Specified Player isn't Connected!"); } if(targetid == playerid) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You Cannot Heal Yourself. Use /med Instead."); } if(GetPlayerTeam(targetid) != GetPlayerTeam(playerid)) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You Cannot Heal Enemies! Traitor!"); } new Float:pos[3]; new sstr[56]; GetPlayerPos(playerid, pos[0], pos[1], pos[2]); if(!IsPlayerInRangeOfPoint(targetid, 10.0, pos[0], pos[1], pos[2])) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}The Specified Player isn't Near You."); } if(medicine[playerid] <= 0) { return SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}You Are Out Of Medicines Stock."); } new Float:hp; GetPlayerHealth(targetid, hp); if(hp>=100) { format(sstr,sizeof(sstr),"{FF0000}Error: {FFFFFF}%s (%d) Already Has Full Health.",GetName(targetid), targetid); return SendClientMessage(playerid, -1, sstr); } if(hp + 25.0 >= 100.0) { medicine[playerid]--; SetPlayerHealth(targetid, 100); format(sstr,sizeof(sstr),"~g~HEALED~n~~w~~h~%d/5 Medicines left",medicine[playerid]); GameTextForPlayer(playerid,sstr,5000,3); GameTextForPlayer(playerid, "~g~HEALED", 5000, 3); PlayerPlaySound(targetid, 1133, 0.0, 0.0, 0.0); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); return SendClientMessage(targetid, -1, "{00FFFF}Notification: {FFFFFF}Your Health is now Full!"); } if(hp + 25.00 < 100.0) { medicine[playerid]--; SetPlayerHealth(targetid, hp + 25); format(sstr,sizeof(sstr),"~g~HEALED~n~~w~~h~%d/5 Medicines left", medicine[playerid]); GameTextForPlayer(playerid, sstr, 5000, 3); GameTextForPlayer(playerid, "~g~HEALED", 5000, 3); PlayerPlaySound(targetid, 1133, 0.0, 0.0, 0.0); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); new Float:new_hp = hp + 25.0; format(sstr,sizeof(sstr),"{00FFFF}Notification: {FFFFFF}Your Health is now (%0.2f).",new_hp); return SendClientMessage(targetid, -1, sstr); } return 1; }