SA-MP Forums Archive
OnPlayerConnect not being called - 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: OnPlayerConnect not being called (/showthread.php?tid=662930)



OnPlayerConnect not being called - Uberanwar - 16.01.2019

I have a weird issue, my OnPlayerConnect callback is not being called when I try to connect to the server.

Code:
public OnPlayerConnect(playerid)
{
        printf("player ID %i [IP/port: %s:%i] connected to the server", playerid);

	SpectateJoinCamera(playerid);


	if(!IsValidDynamic3DTextLabel(PlayerData[playerid][pNameTag]))
		PlayerData[playerid][pNameTag] = CreateDynamic3DTextLabel("Loading nametag...", 0xFFFFFFFF, 0.0, 0.0, 0.1, NT_DISTANCE, .attachedplayer = playerid, .testlos = 1);

	if(g_PlayerLagTimer[playerid] != -1) {

	    KillTimer(g_PlayerLagTimer[playerid]);
	    g_PlayerLagTimer[playerid] = -1;
	}

	g_LagState[playerid] = false;

	GetPlayerIp(playerid, g_PlayerIp[playerid], 16);

	PlayAudioStreamForPlayer(playerid, "https://*******/WJ2Frx");

	ResetPlayerWeapons(playerid), SetPlayerArmedWeapon(playerid, 0);

	TP_AwaitingPos[playerid][0] = -1.0;

	if (g_ServerRestart) {
		TextDrawShowForPlayer(playerid, gServerTextdraws[3]);
	}
	for(new i = 0; i != MAX_PLAYER_ATTACHED_OBJECTS; i ++) {
	    RemovePlayerAttachedObject(playerid, i);
	}

	LoadPlayerSoccerTextDraws(playerid);


   	PlayerData[playerid][pTLAttached] = 0; // FlashLight system
	PlayerData[playerid][pFLAttached] = 0; // FlashLight system

	CancelSelectTextDraw(playerid);

	GetPlayerIp(playerid, PlayerData[playerid][pIP], 16);
	GetPlayerName(playerid, PlayerData[playerid][pUsername], MAX_PLAYER_NAME + 1);

	ResetStatistics(playerid);
	CreateTextDraws(playerid);
	
	new	str[300];

	format(str, sizeof(str), "SELECT * FROM `blacklist` WHERE `Username` = '%s' OR `IP` = '%s'", ReturnName(playerid), PlayerData[playerid][pIP]);
	mysql_tquery(g_iHandle, str, "OnQueryFinished", "dd", playerid, THREAD_BAN_LOOKUP);
	
	return true;
}



Re: OnPlayerConnect not being called - RogueDrifter - 16.01.2019

The only thing i could think of causing this is a hook that stopped the sequence, seek for any previous hooks in ur includes or something, also try running crashdetect and check ur log


Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

Quote:
Originally Posted by RogueDrifter
View Post
The only thing i could think of causing this is a hook that stopped the sequence, seek for any previous hooks in ur includes or something, also try running crashdetect and check ur log
Oh, so it could be one of my includes causing this then.. And I did run the crashdetect but it didn't found any issues.


Re: OnPlayerConnect not being called - RogueDrifter - 16.01.2019

Yeah then its an include for sure


Re: OnPlayerConnect not being called - Kaliber - 16.01.2019

I had the same issue too one time.

It came from an include that hooked OnPlayerConnect but didnt called it in the gamemode


Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

Didn't work.. I've even tried to disabling all those includes. This is so weird


Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

a) Yes, the callback isn't called. Regarding the print, I realized that and I did fix it. But still..
I even print incoming connection through OnIncomingConnection, here's what I get.

Code:
[21:13:14] ----- ARPG has now completely loaded.
[21:13:14] Number of vehicle models: 3
[21:13:32] [query:p] from 127.0.0.1
[21:13:32] [query:i] from 127.0.0.1
[21:13:32] [query:p] from 127.0.0.1
[21:13:32] [query:c] from 127.0.0.1
[21:13:32] [query:r] from 127.0.0.1
[21:13:32] [query:p] from 127.0.0.1
[21:13:35] [query:i] from 127.0.0.1
[21:13:35] [query:p] from 127.0.0.1
[21:13:35] [query:c] from 127.0.0.1
[21:13:35] [query:r] from 127.0.0.1
[21:13:35] [query:p] from 127.0.0.1
[21:13:56] [connection] 127.0.0.1:62681 requests connection cookie.
[21:14:27] Kicking 127.0.0.1 because they didn't logon to the game.
[21:14:51] [query:p] from 127.0.0.1
[21:14:53] [query:p] from 127.0.0.1
[21:14:54] [query:p] from 127.0.0.1
[21:14:55] [query:i] from 127.0.0.1
[21:14:55] [query:p] from 127.0.0.1
[21:14:55] [query:c] from 127.0.0.1
[21:14:55] [query:r] from 127.0.0.1
[21:14:55] [query:p] from 127.0.0.1
[21:14:57] [query:p] from 127.0.0.1
[21:18:09] [connection] incoming connection: 127.0.0.1:62681 id: 0
[21:18:09] Incoming connection for player ID 0 [IP/port: 127.0.0.1:62681]
[21:18:09] Invalid client connecting from 127.0.0.1
b) Yup, I disabled all. Still happening.


Re: OnPlayerConnect not being called - Hunud - 16.01.2019

Might be a problem in some plugins you use ?


Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

I even tried disabling other plugins. Still not working..

Here's the plugins I am currently using as of now;
mysql Whirlpool sscanf streamer


Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

That message came a bit late.. I am not sure why.

[21:14:27] Kicking 127.0.0.1 because they didn't logon to the game.

By that^ time, which was 4 minutes before it says Invalid Client kicked, I already have the game closed.

I did try to connect.


Quote:

[21:57:49] {FFFFFF}SA-MP {B9C9BF}0.3.7-R3 {FFFFFF}Started

[21:57:52] Connecting to 127.0.0.1:7777...

[21:57:53] Connected. Joining the game...

[21:58:23] Server closed the connection.



Re: OnPlayerConnect not being called - Uberanwar - 16.01.2019

Quote:
Originally Posted by ******
Посмотреть сообщение
Are you using the correct client/server versions? This really doesn't seem like a problem with your callback any more.
Yes. I am using the correct and the latest both client and server versions.


Re: OnPlayerConnect not being called - RogueDrifter - 16.01.2019

IDK maybe this doesn't make sense but MAYBE it's a filterscript?


Re: OnPlayerConnect not being called - Uberanwar - 30.01.2019

I finally found the problem. I disabled mysql_log(ALL); in OnGameModeinit and it works now, pretty weird..


Re: OnPlayerConnect not being called - fiki574 - 30.01.2019

Quote:
Originally Posted by Uberanwar
Посмотреть сообщение
I finally found the problem. I disabled mysql_log(ALL); in OnGameModeinit and it works now, pretty weird..
Jeez, would be cool to have this written down somewhere as it might happen for others.

Nice find tho.