/heal Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /heal Command (
/showthread.php?tid=439480)
/heal Command -
NoahF - 25.05.2013
I need a /heal [playerid] command that will heal a player back to full health.
Here is the Medic check:
Re: /heal Command -
Hoborific - 25.05.2013
This isn't a script request section, you ask for help here when you can't do it yourself, not ask for others to code for you.
Regardless it's a two second job assuming you have ZCMD and sscanf, if you do I can write something basic up for you.
Re: /heal Command -
NoahF - 25.05.2013
I need it to be dcmd.
Re: /heal Command -
DobbysGamertag - 25.05.2013
pawn Код:
dcmd_heal(playerid,params[])
{
new id;
// if(!IsAMedic(playerid))
// return SendClientMessage(playerid, -1, "You need to be a medic to use that command!");
if(sscanf(params,"u",id))return SendClientMessage(playerid,-1,"/heal <id>");
else
{
SetPlayerHealth(id,100);
GameTextForPlayer(id,"healed by medic",2000,1);
}
return 1;
}
it compiles fine, and works with ZCMD. Not too sure about DCMD though, just checked sa-mp wiki. Hopefully it works ok for you. SSCANF is needed by the way
EDIT: scrolled down on the wiki, found this:
pawn Код:
dcmd_heal(playerid, params[])
{
new id;
if (!strlen(params)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
id = strval(params);
if (!IsPlayerConnected(id))SendClientMessage(playerid, 0xFF0000AA, "Player not found");
SetPlayerHealth(id, 100.0);
SendClientMessage(id, 0x00FF00AA, "You have been healed");
SendClientMessage(playerid, 0x00FF00AA, "Player healed");
return 1;
}
Now you have free choice of command
Re: /heal Command -
Hoborific - 25.05.2013
I'm not happy with it but here's the rough idea I just rushed out.
pawn Код:
dcmd_heal(playerid,params[])
{
if(IsAMedic(playerid) ) return SendClientMessage(playerid,0xffffff,"You are not a medic");
new target;
if(sscanf(params,"u",target) ) return SendClientMessage(playerid,0xffffff,"Enter ID");
if(!IsPlayerConnected(target) ) return SendClientMessage(playerid,0xffffff,"Not Connected.");
new Float:XYZ[3];
GetPlayerPos(target,XYZ[0],XYZ[1],XYZ[2]);
if(IsPlayerInRangeOfPoint(playerid,10,XYZ[0],XYZ[1],XYZ[2]) )
{
SendClientMessage(target,0xffffff,"dun healed");
SendClientMessage(playerid,0xffffff,"Dun healed dem");
SetPlayerHealth(target,100.0);
return 1;
}
return 1;
}
Re: /heal Command -
NoahF - 25.05.2013
Thank you.