11.02.2011, 13:36
(
Последний раз редактировалось Rachael; 11.02.2011 в 14:08.
)
Quote:
+ 1, SSCANF doesn't make much use if you use STRCMP, you should either use ZCMD or YCMD.
|
[edit]
Quote:
Also an error:
Should be: pawn Код:
|
using sscanf to extract a single parameter kind of defeats the purpose.
finally, cmdtext will include the /o command ( in this example ) so this is what sscanf will extract, not the text following.
so all you really need is something like this...
pawn Код:
if(!strcmp(cmdtext,"/o",true,2))
{
if(strlen(cmdtext) < 4) return SendClientMessage(playerid,COLOR_COLOR,"USAGE: /o [text]");
strdel(cmdtext,0,3);
new
string[128],
pName[MAX_PLAYER_NAME]
;
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"(( %s : %s ))",pName,cmdtext);
SendClientMessageToAll(COLOR_COLOR,string);
return 1;
}
This brings us back to the reason why using zcmd is so much easier
pawn Код:
CMD:o(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid,COLOR_COLOR,"USAGE: /o [text]");
new
string[128],
pName[MAX_PLAYER_NAME]
;
GetPlayerName(playerid,pName,sizeof(pName));
format(string,sizeof(string),"(( %s : %s ))",pName,params);
SendClientMessageToAll(COLOR_COLOR,string);
return 1;
}