OnRconCommand
#1

I know if i use OnRconCommand in gamemode , the rcon command will don't work , so i decide to use it on filterscript

pawn Код:
public OnRconCommand(cmd[])
{
    new cmdEx[256],idx,string[128];
    cmdEx = strtok(cmd,idx);
    if(!strcmp(cmdEx,"kickall",true))
    {
    new i;
        new length = strlen(cmd);
        while ((idx < length) && (cmd[idx] <= ' '))
        {
            idx++;
        }
        new offset = idx;
        new result[64];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmd[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
          SendRconCommand("echo USAGE: kickall [Reason]");
          return 1;
        }
          for(new x; x < GetMaxPlayers(); x++)
          {
               if(IsPlayerConnected(x))
               {
                 format(string,sizeof string,"You have been kicked by Rcon , reason: %s",result);
                 SendClientMessage(x,0xFFFFFFFF,string);
                 Kick(x);
                 i++;
               }
          }
}
In a day , the server reach 90 - 100 players , so i used this command ... the first 24 players get kicked with that reason , and then , bam , server crashed ... Why ?
Reply
#2

bump ?!
Reply
#3

how the **** did u compile this if a } is missing? XD but anyway try changing getmaxplayers to MAX_PLAYERS
dunno if this is any difference -,- but lol custom rcon commands are something like a legend... not much used.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)