Commands from the console?
#1

I need help please, I tried this callback:

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

How can I create a Console Command?
Reply
#2

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

Did you read this? Everything is explained there.
Reply
#3

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

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

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
Reply
#6

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

I write the cmd in the black box.
Reply
#8

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?
Reply
#9

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...
}
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)