23.01.2010, 23:13
Escribimos esto:
Definimos el comando dcmd:
Y ahora lo creamos.
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
pawn Код:
dcmd(mp, 2, cmdtext);
pawn Код:
dcmd_mp(playerid, params[])
{
new ID, text[256];
if(sscanf(params, "is", ID, text)) SendClientMessage(playerid, 0xFFFF00FF, "USA: /MP <id> <texto>");
else if(IsPlayerConnected(ID) == 0)
{
new string[100];
format(string, 100, "%d no estб jugando.", ID);
SendClientMessage(playerid, 0xFF0000FF, string);
}
else
{
new string[300], name[60], name2[60];
GetPlayerName(playerid, name, 60);
GetPlayerName(ID, name2, 60);
format(string, 300, "(%s[%d]) (MP): %s", name, playerid, text);
SendClientMessage(ID, 0xFF8000FF, string);
format(string, 300, "Has enviado a %s[%d] un mensaje privado: %s", name2, ID, text);
SendClientMessage(playerid, 0xFF8000FF, string);
}
return 1;
}