GetPlayerName(playerid, name, sizeof(name));
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
if(success)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "{FF6600}%s {FFFFFF} has logged in as RCON Administrator", name);
SendClientMessageToAll(COLOR_WHITE, string);
return 1;
}
}
Take a look at Example Usage here, https://sampwiki.blast.hk/wiki/OnRconLoginAttempt
|
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;
}
}
}
}
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;
}
}
}
}
how i can getplayername if theres no playerid in public OnRconLoginAttempt(ip[], password[], success)
|
for(new i = GetPlayerPoolSize(); i != -1; --i) //Loop through all players
{
GetPlayerIp(i, pip, sizeof(pip));
if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
{
SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!"); //Send a message
Ban(i); //They are now banned.
}
}
playerid isn't defined in OnRconLoginAttempt
This is the standard way for getting the player's name: PHP код:
PHP код:
|
format(string, sizeof(string), "{FF6600}%s {FFFFFF} has logged in as RCON Administrator", name);
SendClientMessage(i, -1, string); //This
Because he forgot to add this here.
PHP код:
|