21.08.2009, 18:57
I know if i use OnRconCommand in gamemode , the rcon command will don't work , so i decide to use it on filterscript
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 ?
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++;
}
}
}