Rcon system help
#1

mm hey there I have made an rcon system to my server but it isn working good when he log in as rcon he should put second rcon pass but if I put any 2 rcon pass it make him login so he is supposed to be blocked if the second rcon pass here is the code:
Код:
public OnRconLoginAttempt(ip[],password[],success)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnectedEx(i))
        {
			new pip[16];
   			GetPlayerIp(i,pip,sizeof(pip));
    		if(!strcmp(ip,pip,true))
    		{
				if(!success)
        	    {
	    	    	new string[128];
	    	    	format(string,sizeof(string),"SERVER: {FFFFFF}%s tried to login as RCON with the password %s",PlayerName(i),password);
	    	    	SendMessageToAdmins(RED,string);
        	    }
				if(success)
    			{
    			    ShowPlayerDialog(i,SVPASS,DIALOG_STYLE_PASSWORD,"{FF0000}Remote Console","{FFFFFF}Fox Gaming RolePlay/FreeRoam Remote Console\n\nPlease Enter Remote Console Password","Enter","");
			    }
    		}
		}
	 }
    return 1;
}
that ondialogresponce:
if(dialogid==SVPASS)
	{
		if(!response)
		{
			Kicked[playerid]=1;
			SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Access Denied");
		}
		if(response)
		{
			if(strcmp(inputtext,"78836784",true)==0)
			{
        		PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
     			SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Authorized Access");
     			if(AdminLevel[playerid]!=4)
     			{
				 	AdminLevel[playerid]=4;
     				SendClientMessage(playerid,-1,"You have been set has Owner,automatically");
				}
			}
  			if(strcmp(inputtext,"78836784",true) !=0)
  			{
     			SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Access Denied");
			 	ShowPlayerDialog(playerid,SVPASS,DIALOG_STYLE_PASSWORD,"{FF0000}Remote Console","{FFFFFF}Fox Gaming RolePlay/FreeRoam Remote Console\n\nPlease Enter Remote Console Password","Enter","");
			}
		}
		return 1;
	}
plz help me as much as u can
Reply
#2

You cannot really block somebody like that; the RCON password is something apart from the script.
Reply
#3

Quote:

if(!strcmp(ip,pip,true))
{

This will always be true sir
Reply
#4

Quote:
Originally Posted by iLearner
Посмотреть сообщение
This will always be true sir
What does the 'true or false' argument even matter here, they're both fine. He's just checking if any of the players are trying to log into the RCON, or if the login attempt is coming from outside. Nothing weird about that.
Reply
#5

You must check if the inputtext's length is greater than 0. Because strcmp returns 0 when compared to an empty string. So that anyone could type nothing and get accessed.

Also, your second rcon system will request for it's login when multiple players are connected with the same IP address and one among them logs in. I suggest you to use OnPlayerRconLogin.
Reply
#6

what I need is the second rcon the rcon is working good but the second rcon when I put the code of it it always logme in
Reply
#7

The server will automatically set player as RCON administrator upon logging in using /rcon login. The best way to resolve this would be to use the actual rcon command as second rcon. Anyone who logs in as rcon administrator without being passed by server sided rcon login can be kicked. Another way would, if I'm recalling correctly, YSF provided a function to set as RCON administrator using it's function. You can use it to disable the player being RCON administrator on the first login and grant access only if they've passed the second RCON login.
Reply
#8

PHP код:
if(dialogid==SVPASS)
{
    if(!
response)
    {
        
Kicked[playerid]=1;
        
SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Access Denied");
        
Kick(playerid);
    }
    if(
response)
    {
        if(!
strcmp(inputtext,"78836784",true))
        {
            
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            
SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Authorized Access");
            if(
AdminLevel[playerid]!=4)
            {
                
AdminLevel[playerid]=4;
                
SendClientMessage(playerid,-1,"You have been set has Owner,automatically");
            }
        }
        else
        {
            
SendClientMessage(playerid,RED,"SERVER: {FFFFFF}Access Denied");
            
ShowPlayerDialog(playerid,SVPASS,DIALOG_STYLE_PASSWORD,"{FF0000}Remote Console","{FFFFFF}Fox Gaming RolePlay/FreeRoam Remote Console\n\nPlease Enter Remote Console Password","Enter","");
        }
    }
    return 
1;

Reply
#9

I gave me 4 errors
Reply
#10

Quote:
Originally Posted by Yaa
Посмотреть сообщение
pastable code that doesn't work
You really need to stop throwing up code in vain attempts that you randomly fix it with no explanation, or effort other than to simply re-arrange shit to get a +rep...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)