new reason[256];
reason = strrest(cmdtext,idx);
new reason[128];
reason = strrest(cmdtext,idx);
if(!strcmp(cmd,"/kick", true))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"[Error:] You're not an administrator!");
tmp = strtok(cmdtext,idx);
new id = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid,COLOR_WHITE,"[USAGE:] /kick [ID] [Reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"[Error:] Invalid ID");
new reason[256];
reason = strrest(cmdtext,idx);
format(string, sizeof(string),"AdmCmd: %s was kicked by %s, Reason: %s",GetName(id),GetName(playerid),reason);
SendClientMessageToAll(0xFF9900AA, string);
Kick(id);
return 1;
}
Basically that's because whoever wrote the "strrest" function that you are using didn't follow that advice either. Anyway, you are MUCH better off learning y_commands (or ZCMD) and sscanf for writing commands - they make the whole thing vastly easier. Anyway, "strrest" is a completely pointless function as "cmdtext" already contains all the rest of itself so there's no need at all to copy it to another variable.
|