OnRconCommand

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:25, 24 June 2017
Freaksken (Talk | contribs)
(Added note)
← Previous diff
Revision as of 21:34, 24 June 2017
Freaksken (Talk | contribs)
(Note update)
Next diff →
Line 11: Line 11:
{{notes| {{notes|
-* When '''/rcon login''' is used, [[OnRconLoginAttempt]] will be called instead. 
* "/rcon " is not included in "cmd" when a player types a command. * "/rcon " is not included in "cmd" when a player types a command.
-* If you use the "print" function here, it will send a message to the player who typed the command in-game as well as the log.}}+* If you use the "print" function here, it will send a message to the player who typed the command in-game as well as the log.
 +* When the player is not logged in as RCON admin and uses '''/rcon login''', this callback will not be called. However, when the player is logged in as RCON admin, the use of this command will call this callback.}}
{{Example}} {{Example}}

Revision as of 21:34, 24 June 2017



Description:

This callback is called when a command is sent through the server console, remote RCON, or via the in-game "/rcon command".


Parameters:
(cmd[])
cmd[]A string containing the command that was typed, as well as any passed parameters.


Return Values:

0 if the command was not processed, it will be passed to another script or 1 if the command was processed, will not be passed to other scripts.


Image:32px-Circle-style-warning.png

Important
Note

You will need to include this callback in a loaded filterscript for it to work in the gamemode!


Image:32px-Ambox_warning_orange.png

Notes

  • "/rcon " is not included in "cmd" when a player types a command.
  • If you use the "print" function here, it will send a message to the player who typed the command in-game as well as the log.
  • When the player is not logged in as RCON admin and uses /rcon login, this callback will not be called. However, when the player is logged in as RCON admin, the use of this command will call this callback.


Example Usage:

public OnRconCommand(cmd[])
{
    printf("[RCON]: You typed '/rcon %s'!", cmd);
    return 0;
}
public OnRconCommand(cmd[])
{
    if(!strcmp(cmd, "hello", true))
    {
        SendClientMessageToAll(0xFFFFFFAA, "Hello World!");
        print("You said hello to the world."); // This will appear to the player who typed the rcon command in the chat in white
        return 1;
    }
    return 0;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.


Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

Personal tools
In other languages