Ask about new fuction.
#1

i'm confuse between fuction strcmp with new fuction dcmd.

any fuction is good more than and help explain about dcmd.

sorry for my bad english.
Reply
#2

I don't think anyone understands what you just wrote. Could you try to be more specific and explain more.

Sorry.
Reply
#3

Quote:
Originally Posted by boynumber5
i'm confuse between fuction strcmp with new fuction dcmd.

any fuction is good more than and help explain about dcmd.

sorry for my bad english.
Quote:
Originally Posted by IntrozeN
I don't think anyone understands what you just wrote. Could you try to be more specific and explain more.

Sorry.
He is confused with strcmp and dcmd command systems. He is wondering which one is better and he needs help explaining about how to use dcmd and how it works.
Reply
#4

yes, can you explain that for me please !!
Reply
#5

You put this on the top of your gm
pawn Код:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Creating the command
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(heal, 4, cmdtext); //this is the same as if(strcmp(cmdtext, "/heal", true) == 0)
    return 0;
}

The actual command itself. Put this on the very bottom of your script
This command will heal a player of your choice (the same example as on wiki)

playerid is the same as the player who typed the command
params, which is always a string!, is the text the player typed AFTER /heal.
So if the player typed "/heal 25", params will be "25"

pawn Код:
dcmd_heal(playerid, params[])
{
    if (strlen(params)) //if the lenght of "params" is more then zero (if the player actually typed anything after /heal)
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
            SetPlayerHealth(id, 100.0);
            SendClientMessage(id, 0x00FF00AA, "You have been healed");
            SendClientMessage(playerid, 0x00FF00AA, "Player healed");
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: /heal <playerid>");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)