21.12.2010, 12:40
That code won't work
strtok will return the next word separated by a space ( not the whole line )
is incorrect, strval returns an integer
also, you have %s in the format, and you are formatting an integer.
you have defined str[128] and then used string
try this
In this instance, idx will already hold the reference for the start of the 'chat' portion of cmdtext
pawn Код:
result = strtok(cmdtext, idx);
pawn Код:
if(!strlen(strval(result)))
also, you have %s in the format, and you are formatting an integer.
you have defined str[128] and then used string
try this
pawn Код:
if(!strcmp(cmd, "/admin", true) || !strcmp(cmd, "/a", true))
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new result[128], str[128], sendername[MAX_PLAYER_NAME];
strmid(result,cmdtext,idx,strlen(cmdtext),sizeof(result));
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)dmin [admin chat]");
GetPlayerName(playerid,sendername,sizeof(sendername));
format(str, sizeof(str), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
SendAdminMessage(COLOR_YELLOW, str);
return 1;
}
SendClientMessage(playerid,COLOR_GRAD2,"Unauthorized command");
return 1;
}

