[Tutorial] RCON Login protection
#20

You are checking for one thing two times:
PHP код:
            if(RconAttempt[i] < MAX_RCONATTEMPTS && !strcmp(ippIP)) //Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

                
RconAttempt[i]++; // if it's not reached, we will increase this variable 
            

            else if(
RconAttempt[i] >= MAX_RCONATTEMPTS && !strcmp(ippIP)) // Check if the player reached the maximum attempts (2) 
            

                
format(stringsizeof string"%s has been automatically banned from the server. Reason: Attempting to hack the RCON password."pname); 
                
SendClientMessageToAll(COLOR_REDstring); // Send the formatted message to everyone in red. 
                
Ban(i); // Ban the player who tried to login twice. 
            

The `!strcmp(ip, pIP)` It can be done like this:
PHP код:
            if(strcmp(ippIP)) return 1;
if(
RconAttempt[i] < MAX_RCONATTEMPTS//Check if the player hasn't reached the MAX_RCONATTEMPTS 
            

                
RconAttempt[i]++; // if it's not reached, we will increase this variable 
            

            else if(
RconAttempt[i] >= MAX_RCONATTEMPTS// Check if the player reached the maximum attempts (2) 
            

And in addition to this you are getting every player's name while you only need one players name:
PHP код:
    for(new 0GetPlayerPoolSize(); <= ji++) // This is the loop, 'GetPlayerPoolSize' checks the highest ID IG, hence I'd rather use that loop instead of MAX_PLAYERS; 
    

        if(
IsPlayerConnected(i)) // Check if the player is even connected 
        

            
GetPlayerName(ipnameMAX_PLAYER_NAME); // Get the player's name 
And also delay declaring global variables.
Reply


Messages In This Thread
RCON Login protection - by saffierr - 05.07.2017, 00:21
Re: RCON Login protection - by SteSte - 05.07.2017, 00:38
Re: RCON Login protection - by Astralis - 05.07.2017, 00:42
Re: RCON Login protection - by SteSte - 05.07.2017, 00:53
Re: RCON Login protection - by Konstantinos - 05.07.2017, 08:24
Re: RCON Login protection - by iLearner - 05.07.2017, 11:37
Re: RCON Login protection - by saffierr - 05.07.2017, 11:55
Re: RCON Login protection - by saffierr - 05.07.2017, 11:57
Re: RCON Login protection - by RxErT - 05.07.2017, 12:19
Re: RCON Login protection - by saffierr - 05.07.2017, 16:27
Re: RCON Login protection - by Eoussama - 05.07.2017, 17:04
Re: RCON Login protection - by Vince - 05.07.2017, 17:15
Re: RCON Login protection - by HoussemGaming - 05.07.2017, 18:41
Re: RCON Login protection - by Meller - 05.07.2017, 21:10
Re: RCON Login protection - by saffierr - 06.07.2017, 02:12
Re: RCON Login protection - by coool - 06.07.2017, 12:22
Re: RCON Login protection - by iLearner - 06.07.2017, 12:38
Re: RCON Login protection - by TheRealMan - 06.07.2017, 12:40
Re: RCON Login protection - by saffierr - 06.07.2017, 13:10
Re: RCON Login protection - by coool - 07.07.2017, 06:09
Re: RCON Login protection - by Beryllium - 07.07.2017, 07:18
Re: RCON Login protection - by TeKno - 30.07.2017, 09:02
Re: RCON Login protection - by C4rtm4n - 01.08.2017, 09:42

Forum Jump:


Users browsing this thread: 1 Guest(s)