OnRconLoginAttempt
#1

Hi,

Why this callback don't have playerid?
Reply
#2

It has a parameter for IP, you can get playerid from it just like the wiki example here - https://sampwiki.blast.hk/wiki/OnRconLoginAttempt.
Reply
#3

Yes i knno that.. But it's possible this callback can get called, when player is not connected?
Reply
#4

No
This callback is called when someone tries to login to RCON, succesful or not.
And The Player Should be Connected :P
Reply
#5

I'm pretty sure the reason it doesn't use playerid is because it's possible to do remote logins. If you want to get the playerid of the person who did the login, do something like this:

Код:
public OnRconLoginAttempt(ip[], password[], success) {
	new id = -1, ip2[16];
	printf("IP of player who did the login is %s", ip);
	
	for (new i = 0; i < GetMaxPlayers(); i++) {
		GetPlayerIp(i, ip2, 16);
		if (!strcmp(ip, ip2, true)) {
			id = i;
			break;
		}
	}

	if (id == -1) {
		printf("Someone tried to log in as RCON and I couldn't get their name. IP is %s.", ip);
	}
	else {
		printf("Player ID %i logged in as RCON!", id);
	}
	
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)