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; }
if(success)
{
for(new p=0;p<MAX_PLAYERS;p++)
{
new name[24], string[120];
GetPlayerName(p,name,24);
format(string, sizeof(string),"{FF0000}(INFO) %s has logged into RCON", name);
SendMessageToAdmins(string);
pInfo[p][Admin] = 4;
}
}
}
return 1;
}
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. |
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);
}
}
}
}
pawn Код:
|
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; }