13.02.2010, 20:28
How to get text on player command??
for example someone type this: /command 24
and then pawn will get this 24
for example someone type this: /command 24
and then pawn will get this 24
if(!strcmp(cmdtext,"/command",8,true)) { new tmp = cmdtext[9]; // if its string, then leave it, if its integer change to: new tmp = strval(cmdtext[9]); new string[10]; format(string,10,"Pawn gets: %s",tmp); // if its integer change the %s to %d, else leave it. return SendClientMessage(playerid,0xFFFFFFFF,string); }
Originally Posted by sebacol
TNX but how can I now if someone type this: /command 1 blah blah blah blah blah
how to get this num and all that text? |
dcmd(command,8,cmdtext);
#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
Originally Posted by adsy
he missed the 1 vital line at the top
Код:
#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 |