OnRconLoginAttempt.
#1

Why wouldn't it set me level for?

Код:
	   if(success)
	   {
		   	for(new i = 0, j=GetPlayerPoolSize(); i<=j; i++)
		   	{
			  	pInfo[i][Admin] = 4;
			  	new str[128];
			  	format(str, sizeof(str),"{FF0000}(INFO) %s has logged into RCON", PlayerName[i]);
			  	SendMessageToAdmins(str);
		   	}
		}
    }
    return 1;
}
Reply
#2

You're looping through playerid 0 to the max playerid connected. Some of the players inbetween those id's could be disconnected. You need to check if they're connected.

You also need to check if that player has the same IP adress as the player attempting to login. Otherwise you will end up promoting every player connected to admin.
Reply
#3

PHP код:
if(success)
       {
               for(new 
p=0;p<MAX_PLAYERS;p++) 
               {
                  new 
name[24], string[120];
                                
GetPlayerName(p,name,24);
                  
format(stringsizeof(string),"{FF0000}(INFO) %s has logged into RCON"name);
                  
SendMessageToAdmins(string);
                                
pInfo[p][Admin] = 4;
               }
        }
    }
    return 
1;

try this
Reply
#4

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
You're looping through playerid 0 to the max playerid connected. Some of the players inbetween those id's could be disconnected. You need to check if they're connected.

You also need to check if that player has the same IP adress as the player attempting to login. Otherwise you will end up promoting every player connected to admin.
Mind giving an example?
Reply
#5

pawn Код:
public OnRconLoginAttempt(ip[], password[], success) {
    if( success ) {
        new player_ip[15+1], message_str[100];
        for(new playerid, max_playerid = GetPlayerPoolSize(); playerid <= max_playerid; playerid ++) {
            if( !IsPlayerConnected(playerid) ) {
                continue;
            }

            GetPlayerIp(playerid, player_ip, sizeof player_ip);
            if( !strcmp( player_ip, ip) ) {
                pInfo[playerid][Admin] = 4;
                format(message_str, sizeof message_str,"{FF0000}(INFO) %s has logged into RCON", PlayerName[playerid]);
                SendMessageToAdmins(message_str);
            }    
        }
    }
}
Reply
#6

Quote:
Originally Posted by RedFusion
Посмотреть сообщение
pawn Код:
public OnRconLoginAttempt(ip[], password[], success) {
    if( success ) {
        new player_ip[15+1], message_str[100];
        for(new playerid, max_playerid = GetPlayerPoolSize(); playerid <= max_playerid; playerid ++) {
            if( !IsPlayerConnected(playerid) ) {
                continue;
            }

            GetPlayerIp(playerid, player_ip, sizeof player_ip);
            if( !strcmp( player_ip, ip) ) {
                pInfo[playerid][Admin] = 4;
                format(message_str, sizeof message_str,"{FF0000}(INFO) %s has logged into RCON", PlayerName[playerid]);
                SendMessageToAdmins(message_str);
            }    
        }
    }
}
Okay, I've done this.

Little bit edited

Код:
	if(success)
	{
		new aip[15+1], str[120];
		for(new playerid, max_playerid = GetPlayerPoolSize(); playerid <= max_playerid; playerid ++)
		{
		   if(!IsPlayerConnected(playerid))
		   {
			   continue;
		   }
			   GetPlayerIp(playerid, aip, sizeof(aip));
			   if(!strcmp( aip, ip))
			   pInfo[playerid][Admin] = 4;
			   format(str, sizeof(str), "{FF0000}(INFO) %s has successfully logged into RCON!", PlayerName[playerid]);
			   SendClientMessage(playerid, -1, str);
	    }
	}
	return 1;
}
But there's a really big problem, I've connected with an unregistered account and spawned and I had my existing user stats (including, score,adminlevel, points).
Reply
#7

You need to reset those stats either at connect or disconnect.
I prefer to initiate player variables at connect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)