04.08.2010, 00:01
(
Последний раз редактировалось Luis_Leone; 04.08.2010 в 01:04.
Причина: Fixing.
)
Hello today we are going to learn "Dcmd".
First we start with the #defines.
After we get the Includes and Defines done we can start on the Commands.
Example,
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
You are free to use this /kill command.
And that's it for the Tutorial.
If you get any Errors please post here!
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
Example,
pawn Код:
public OnPlayerCommandText
{
dcmd(kill, 4, cmdtext);
return 1;
}
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;
}
And that's it for the Tutorial.
If you get any Errors please post here!