#1

i'm making that when player failed to login into rcon he got kicked but when he failed to login everyone getting kicked



PHP код:
forward KickPlayer();
public 
KickPlayer()
{
    for (new 
0MAX_PLAYERSi++)
    {
        new 
pname[MAX_PLAYER_NAME], string[128];
        
GetPlayerName(ipnamesizeof(pname));
        
format(stringsizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!"pname);
        
SendClientMessageToAll(COLOR_REDstring);
        
Kick(i);
    }
    return 
1;

Reply
#2

Код:
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
        new pname[MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string, sizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!", pname);
        SendClientMessageToAll(COLOR_RED, string);
        Kick(playerid);
        return 1;
}
You were looping through MAX_PLAYERS and then were kicking them all,
Try that one, and change that
Код:
KickPlayer();
To
Код:
KickPlayer(playerid);
Reply
#3

Код:
//You must pass the id of player you want to kick
forward KickPlayer(playerid); 
public KickPlayer(playerid) 
{ 
    //Here you get the name of player to kick
    new pname[MAX_PLAYER_NAME], string[128]; 
    GetPlayerName(playerid, pname, sizeof(pname)); 
    format(string, sizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!", pname); 

    //Kick the player
    Kick(playerid);
    for (new i = 0; i < MAX_PLAYERS; i++) 
    { 
        //And than send the message to all connected players
        if(IsPlayerConnected(i)) SendClientMessageToAll(COLOR_RED, string); 
    }  
    return 1; 
}
Reply
#4

EDITED :
Quote:
Originally Posted by pollo97
Посмотреть сообщение
Код:
//You must pass the id of player you want to kick
forward KickPlayer(playerid); 
public KickPlayer(playerid) 
{ 
    //Here you get the name of player to kick
    new pname[MAX_PLAYER_NAME], string[128]; 
    GetPlayerName(playerid, pname, sizeof(pname)); 
    format(string, sizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!", pname); 

    //Kick the player
    Kick(playerid);
    for (new i = 0; i < MAX_PLAYERS; i++) 
    { 
        //And than send the message to all connected players
        if(IsPlayerConnected(i)) SendClientMessageToAll(COLOR_RED, string); 
    }  
    return 1; 
}
my brother typed wrong rcon password but server kicking me not him LOL
Reply
#5

Quote:
Originally Posted by DeStRoY232
Посмотреть сообщение
EDITED :

my brother typed wrong rcon password but server kicking me not him LOL
When you call this function you must pass the ID of your brother not your.
Reply
#6

Quote:
Originally Posted by pollo97
Посмотреть сообщение
When you call this function you must pass the ID of your brother not your.
OnRCONLogin doesn't track the ID, only the IP, so when it finds the IP of the brother, it then stops and doesn't kick all of them.

This is the real issue with this. Kick all, or don't kick at all.
Reply
#7

Quote:
Originally Posted by pollo97
Посмотреть сообщение
Код:
//You must pass the id of player you want to kick
forward KickPlayer(playerid); 
public KickPlayer(playerid) 
{ 
    //Here you get the name of player to kick
    new pname[MAX_PLAYER_NAME], string[128]; 
    GetPlayerName(playerid, pname, sizeof(pname)); 
    format(string, sizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!", pname); 

    //Kick the player
    Kick(playerid);
    for (new i = 0; i < MAX_PLAYERS; i++) 
    { 
        //And than send the message to all connected players
        if(IsPlayerConnected(i)) SendClientMessageToAll(COLOR_RED, string); 
    }  
    return 1; 
}
You do realize that
pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
    {
        //And than send the message to all connected players
        if(IsPlayerConnected(i)) SendClientMessageToAll(COLOR_RED, string);
    }
will send not one message, but as many messages as there are connected players.
Reply
#8

So first, you need to find your brother out of his ip:
Код:
public OnRconLoginAttempt(ip[], password[], success)
{
	if(!success)
	{
		for(new i; i<MAX_PLAYERS; i++)
		{
                        if(IsPlayerConnected(i))
                        {
			new pip[200];
			GetPlayerIp(i, pip, sizeof(pip));
			if(strcmp(ip, pip, true, 200))
			{
				KickPlayer(i);
			}
                        }
			return 1;
		}
	}
	return 1;
}
Then you need to change KickPlayer to this:
Код:
forward KickPlayer(playerid); 
public KickPlayer(playerid) 
{  
        new pname[MAX_PLAYER_NAME], string[128]; 
        GetPlayerName(playerid, pname, sizeof(pname)); 
        format(string, sizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!", pname); 
        SendClientMessageToAll(COLOR_RED, string); 
        Kick(playerid); 
        return 1; 
}
Reply
#9

HELP guys other player typed wrong rcon password but server kicking me WTF

here is the code :

PHP код:
public OnRconLoginAttempt(ip[], password[], success)
{
    if(
success)
    {
        new 
pip[16];
        for(new 
GetPlayerPoolSize(); != -1; --i)
        {
            
GetPlayerIp(ipipsizeof(pip));
            if(!
strcmp(ippiptrue))
            {
                
SetTimer("RconMsg"1000false);
            }
        }
    }
    else
    {
        
SetTimer("KickPlayer"1000false);
    }
    return 
1;
}
forward RconMsg(playerid);
public 
RconMsg(playerid)
{
    new 
pname[MAX_PLAYER_NAME], string[128];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(stringsizeof(string), "{AFAFAF}%s {33CC33}has logged in as RCON Administrator"pname);
    
SendClientMessageToAll(COLOR_WHITEstring);
    
format(stringsizeof(string), "Welcome {AFAFAF}%s, {FFFFFF}Type {FF6600}/cmds {FFFFFF}to see Admin commands"pname);
    
SendClientMessage(playeridCOLOR_WHITEstring);
    
PlayerPlaySound(playerid10580.00.00.0);
    return 
1;
}
forward KickPlayer(playerid);
public 
KickPlayer(playerid)
{
    new 
pname[MAX_PLAYER_NAME], string[128]; 
    
GetPlayerName(playeridpnamesizeof(pname)); 
    
format(stringsizeof(string), "{AFAFAF}%s {FF0000}has tried to login in RCON and got Kicked!"pname); 
    
SendClientMessageToAll(COLOR_REDstring);
   
    for (new 
0MAX_PLAYERSi++) 
    { 
        
Kick(i);
    }
    return 
1;

Reply
#10

Quote:
Originally Posted by DeStRoY232
Посмотреть сообщение
HELP guys other player typed wrong rcon password but server kicking me WTF
If it's you and your brother using the same internet connection, and he's 'testing' this, then that's typical, as you will have the same IP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)