SA-MP Forums Archive
RCON - 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)
+--- Thread: RCON (/showthread.php?tid=660241)

Pages: 1 2


Re: RCON - TheToretto - 29.10.2018

I've tested all of my codes, and they're working except if there are some bugs, I hope you can help me spotting them if so.


Re: RCON - BigETI - 29.10.2018

Quote:
Originally Posted by TheToretto
View Post
I've tested all of my codes, and they're working except if there are some bugs, I hope you can help me spotting them if so.
I doubt you actually test and revise your code before publishing it.


Re: RCON - TheToretto - 29.10.2018

Quote:
Originally Posted by BigETI
View Post
I doubt you actually test and revise your code before publishing it.
I do. What's wrong with those two codes? Bascially if someone says "rcon" he'll get warned. But wait, just one word is sufficient, sorry. "rcon" is the same as "/rcon" so no need to add more words. So it'll give:

PHP Code:
public OnPlayerText(playeridtext[]) 
{
    if(
strfind(text"rcon"true) != -1)
    {
        
SendClientMessage(playerid, -1"Bad idea.");
        
// Ban him if you want to :)
        
return 0;
    }
    return 
1;

Then, this one's all right huh?

PHP Code:
public OnRconLoginAttempt(ip[], password[], success

    if(!
success
    { 
        new 
IPAddr[16], str[64]; 
        static 
r_Warnings[MAX_PLAYERS]; 
        for(new 
iMAX_PLAYERSi++) 
        { 
            if(!
IsPlayerConnected(i)) continue; 
            
GetPlayerIp(iIPAddrsizeof(IPAddr)); 
            if(!
strcmp(ipIPAddrfalse)) 
            { 
                if(
r_Warnings[i] < 2)  
                { 
                    
r_Warnings[i]++; 
                    
format(strsizeof(str), "Warnings: (%i / 3)"r_Warnings[i]); 
                    return 
SendClientMessage(i, -1str); 
                } 
                else 
                { 
                    
Kick/*Ex*/(i); // Delay the ban with a timer so the playerid receives the message before getting banned 
                    
return SendClientMessage(i, -1"You've been warned."); 
                } 
            } 
        } 
    } 
    return 
1




Re: RCON - TheToretto - 29.10.2018

Didn't know about it, I'm testing on localhost Ї\_(ツ)_/Ї


Re: RCON - OiLoL - 29.10.2018

Quote:
Originally Posted by v1k1nG
View Post
There are many ways you could do that, like

PHP Code:
new IsRconAuthorized[MAX_PLAYERS];
CMD:rconauthorize(playeridparams[]){
    
// password check, or whatever
    
IsRconAuthorized[playerid] = true// if player passes the checks
    
return 1;
}
public 
OnRconLoginAttempt(ip[], password[], success){
    if(
IsRconAuthorized[playerid] == false)return 1// return whatever you prefer
    // code
    
return 1;   

You cannot use playerid downside the OnRconLoginAttempt ....
OnRconLoginAttempt(ip[], password[], success)

Where can you see playerid here??


Re: RCON - v1k1nG - 29.10.2018

Quote:
Originally Posted by OiLoL
View Post
You cannot use playerid downside the OnRconLoginAttempt ....
OnRconLoginAttempt(ip[], password[], success)

Where can you see playerid here??
Quote:
Originally Posted by v1k1nG
View Post
Yes there's no playerid there, I just fastly wrote an example without meaning to give a real fast solution.
My post was to tell to be creative in finding any solution, as there are many ways to face any matter.
Please read the thread before posting. In the end there are several ways to get the player id in there anyways.


Re: RCON - GangstaSunny. - 29.10.2018

I actually don't realy get it but I'm interested.

The server sends a message to the player if he is trying to login but failed, if those guys still trying to login, they deserved to get trolled for their dumbness.

I send a message (and also log it) to the team if someone tried logging in (even on success). If he is not authorized a team member will talk to him. If there is more than one player using the logged IP, both names will be sent to the team.


Re: RCON - Hunud - 30.10.2018

Woah. I really didn't expect so much answers (4 pages). I will review your codes and suggestions and will choose the most useful ones.

Thanks.


Re: RCON - NaS - 30.10.2018

All the RCON security is useless if you only expect connected players to login. There's also an actual remote Console from which you can login (and send commands) so just searching for a playerid doesn't help when someone wants to brute force the PW or already has it (in the latter case it may be too late anyway, but you can still protect against unwanted access by temp. banning the IP - that also prevents remote console access).


Re: RCON - v1k1nG - 30.10.2018

Quote:
Originally Posted by NaS
View Post
All the RCON security is useless if you only expect connected players to login. There's also an actual remote Console from which you can login (and send commands) so just searching for a playerid doesn't help when someone wants to brute force the PW or already has it (in the latter case it may be too late anyway, but you can still protect against unwanted access by temp. banning the IP - that also prevents remote console access).
Looks good