OnRconLoginAttempt

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:25, 2 December 2011
Smithy (Talk | contribs)

← Previous diff
Revision as of 21:56, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
{{0.3Added|callback|}} {{0.3Added|callback|}}
Line 44: Line 43:
[[Category:Scripting Callbacks]] [[Category:Scripting Callbacks]]
 +
 +[[fr:OnRconLoginAttempt]]

Revision as of 21:56, 31 January 2014



OnRconLoginAttempt was added in SA-MP 0.3a This callback was added in SA-MP 0.3a and will not work in earlier versions!


Description:

This callback is called when someone tries to login to RCON, succesful or not.


Parameters:
(ip[], password[], success)
ip[]The IP of the player that tried to login to RCON.
password[]The password used to login with.
success0 if the password was incorrect or 1 if it was correct.


Return Values:

This callback does not handle returns.


Image:32px-Ambox_warning_orange.png

Note

This callback is only called when /rcon login is used.


public OnRconLoginAttempt(ip[], password[], success)
{
    if(!success) //If the password was incorrect
    {
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
        new pip[16];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
            GetPlayerIp(i, pip, sizeof(pip));
            if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
            {
                SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
                Ban(i); //They are now banned.
            }
        }
    }
    return 1;
}

Related Callbacks

The following callbacks might be useful as well, as they are related to this callback in one way or another.


Related Functions

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

In other languages