get player name if the player trying to login to rcon - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: get player name if the player trying to login to rcon (
/showthread.php?tid=584862)
get player name if the player trying to login to rcon -
PowerF - 08.08.2015
Код:
public OnRconLoginAttempt(ip[], password[], success)
{
if(!strcmp(ip, "ignorethislol", true) || !strcmp(ip, "127.0.0.1", true))
{
if(!success)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && playerData[i][playerLevel] >= 5)
{
new messageContent[128];
format(messageContent, sizeof(messageContent), "{FFDC2E}[RCON ALERT] {FFFFFF}Failed RCON login attempt by {FFDC2E}%s.", ip);
SendClientMessage(i, COLOR_WHITE, messageContent);
return 0;
}
}
}
return 1;
}
else
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && playerData[i][playerLevel] >= 5)
{
new messageContent[128];
format(messageContent, sizeof(messageContent), "{FFDC2E}[RCON ALERT] {FFFFFF}Unknown IP address {FFDC2E}%s {FFFFFF}attempted to login to RCON.", ip);
SendClientMessage(i, COLOR_WHITE, messageContent);
}
}
return 0;
}
}
Re: get player name if the player trying to login to rcon -
xVIP3Rx - 08.08.2015
Just check if the ip matches any of the connected player's ips.
Re: get player name if the player trying to login to rcon -
JimmyCh - 08.08.2015
Well if he's connected you will need to use GetPlayerName like this:
Код:
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
Not really sure if this is the basic thing you were asking of... Do you want to print it on your system or tell you in game or...
And if he's not connected, use a callback to get the player's name from the IP from your database etc...