OnRconCommand - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnRconCommand (
/showthread.php?tid=92713)
OnRconCommand -
UsaBoy91 - 21.08.2009
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 ?
Re: OnRconCommand -
UsaBoy91 - 21.08.2009
bump ?!
Re: OnRconCommand -
Gamer_Z - 22.08.2009
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.