[Tutorial] [dcmd] Commands
#1

Hello today we are going to learn "Dcmd".


First we start with the #defines.

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
After we get the Includes and Defines done we can start on the Commands.

Example,
pawn Код:
public OnPlayerCommandText
{
dcmd(kill, 4, cmdtext);
return 1;
}
You always have to do this when you make a new Command.
The 4 is the number of letters in the word "kill" has "4" letters.
And now here's the code

pawn Код:
dcmd_kill(playerid, params[])
{
    #pragma unused params
    new string[64], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    format(string,sizeof string,"%s Has Died",pName);
    SendClientMessageToAll(0xFFFFFFAA,string);
    SetPlayerHealth(playerid, 0);
    return 1;
}
You are free to use this /kill command.

And that's it for the Tutorial.
If you get any Errors please post here!
Reply


Messages In This Thread
[dcmd] Commands - by Luis_Leone - 04.08.2010, 00:01
Re: [dcmd] Commands - by Daren_Jacobson - 04.08.2010, 00:59
Re: [dcmd] Commands - by Hiddos - 04.08.2010, 20:01
Re: [dcmd] Commands - by Kar - 04.08.2010, 20:11
Re: [dcmd] Commands - by Hiddos - 04.08.2010, 21:17
Re: [dcmd] Commands - by Luis- - 05.08.2010, 19:24
Re: [dcmd] Commands - by Hiddos - 05.08.2010, 20:20
Re: [dcmd] Commands - by Kar - 05.08.2010, 20:32
Re: [dcmd] Commands - by Hiddos - 05.08.2010, 20:47
Re: [dcmd] Commands - by Kar - 05.08.2010, 20:59

Forum Jump:


Users browsing this thread: 1 Guest(s)