[Help] /heal command
#1

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.
Reply
#2

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
Reply
#3

I feel so stupid for not searching >_< I'm sorry for wasting your time, Thank you.
Reply
#4

Its ok, You can find many things using ****** search engine or searching on forums.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)