Originally Posted by Eoussama
playerid isn't defined in OnRconLoginAttempt
This is the standard way for getting the player's name:
PHP код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new IP[32], name[MAX_PLAYER_NAME], string[128];
for(new i, j=GetPlayerPoolSize(); i<j; i++)
{
GetPlayerIp(i, IP, sizeof(IP));
if(!strcmp(ip, IP, false))
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "{FF6600}%s {FFFFFF} has logged in as RCON Administrator", name);
break;
}
}
}
}
If you're using foreach, it can be done like so:
PHP код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new IP[32], name[MAX_PLAYER_NAME], string[128];
foreach(new i : Player)
{
GetPlayerIp(i, IP, sizeof(IP));
if(!strcmp(ip, IP, false))
{
GetPlayerName(i, name, sizeof(name));
format(string, sizeof(string), "{FF6600}%s {FFFFFF} has logged in as RCON Administrator", name);
break;
}
}
}
}
|