SA-MP Forums Archive
Commands from the console? - 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: Commands from the console? (/showthread.php?tid=234292)



Commands from the console? - Sasino97 - 03.03.2011

I need help please, I tried this callback:

pawn Код:
OnRconCommand(cmd[])
But the commands doesn't work!

How can I create a Console Command?


Re: Commands from the console? - JaTochNietDan - 03.03.2011

https://sampwiki.blast.hk/wiki/OnRconCommand

Did you read this? Everything is explained there.


Re: Commands from the console? - Sasino97 - 03.03.2011

But it doesn't work with me..... I'll try ..


Re: Commands from the console? - JaTochNietDan - 03.03.2011

Give us an example of what you are trying and how you are going about testing it.


Re: Commands from the console? - Sasino97 - 03.03.2011

Example:

pawn Код:
if(strcmp(cmd,"kickall",true) == 0)
{
  for(new i=0;i<MAX_PLAYERS;i++)
  {
    SendClientMessageToAll(COLOR_RED,"RCON: An admin as kicked all from the console.");
    Kick(i);
  }
  return 1;
}
I know why it doesn't work with me, because before i was using strtok


Re: Commands from the console? - JaTochNietDan - 03.03.2011

You didn't answer the second part, how did you go about testing it? What did you do to test it exactly?


Re: Commands from the console? - Sasino97 - 03.03.2011

I write the cmd in the black box.


Re: Commands from the console? - JaTochNietDan - 03.03.2011

What exactly did you write in what black box though? You need to provide more information, I can't guess what you did to test it! Did you also read in the SA-MP Wiki that for the OnRconCommand function to work in a gamemode it has to be loaded in a Filterscript first?


Re: Commands from the console? - Mean - 03.03.2011

Tell us the problem, WHAT doesn't work?
Try also.
pawn Код:
if( !strcmp( cmd, "kickall", true, 7 ) )
{
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        SendClientMessageToAll( COLOR_RED,"RCON: An admin as kicked all from the console." );
        Kick( i );
    }
    return 1;
}
EDIT:

Have you also tried:
pawn Код:
if( cmd[ 0 ] == 'kickall' )
{
    // Stuff here...
}



Re: Commands from the console? - Sasino97 - 06.03.2011

IN A FILTERSCRIPT?? Doesn't it work in a GM?