get player name if the player trying to login to rcon
#1

Код:
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;
	}
}
Reply
#2

Just check if the ip matches any of the connected player's ips.
Reply
#3

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)