[Help] /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: [Help] /heal command (
/showthread.php?tid=452913)
[Help] /heal command -
ZeroTheScyther - 23.07.2013
Yo guys I want to make a heal command but I got a big problem .. I don't know how to make a command like /heal [id]
I want the [id] to be whatever number I want (I don't need the whole script just explain me how to make the [id] part) Thank you.
Re: [Help] /heal command -
Champ - 23.07.2013
Found This from sa-mp
pawn Код:
if(strcmp(cmd, "/heal", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "/heal ID");
return 1;
}
new playa;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
SetPlayerHealth(playa, 100);
}
}
}
return 1;
}
Found this from Wiki-Pedia.
pawn Код:
dcmd_heal(playerid, params[])
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SetPlayerHealth(id, 100.0);
SendClientMessage(id, 0x00FF00AA, "You have been healed");
SendClientMessage(playerid, 0x00FF00AA, "Player healed");
}
return 1;
}
CMD:heal(playerid, params[])
{
new
id;
if (sscanf(params, "u", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/heal <playerid>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else
{
SetPlayerHealth(id, 100.0);
SendClientMessage(id, 0x00FF00AA, "You have been healed");
SendClientMessage(playerid, 0x00FF00AA, "Player healed");
}
return 1;
}
https://sampwiki.blast.hk/wiki/Fast_Commands
Re: [Help] /heal command -
ZeroTheScyther - 24.07.2013
I feel so stupid for not searching >_< I'm sorry for wasting your time, Thank you.
Re: [Help] /heal command -
Champ - 24.07.2013
Its ok, You can find many things using ****** search engine or searching on forums.