SA-MP Forums Archive
some parts not working at OnPlayerRequestClass - 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: some parts not working at OnPlayerRequestClass (/showthread.php?tid=629243)



some parts not working at OnPlayerRequestClass - GoldenLion - 22.02.2017

Hi, I made some changes to the ban system and now some parts don't seem to work under OnPlayerRequestClass.
This is what it looks like:
Код:
public OnPlayerRequestClass(playerid, classid)
{
	print("called");
	
	if (!PlayerInfo[playerid][pLogged])
	{
	        print("not logged in");
	    
		new query[128];
		
		RemoveBuildingForPlayer(playerid, 1302, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 1209, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 955, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 956, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 1775, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 1776, 0.0, 0.0, 0.0, 6000.0);
		RemoveBuildingForPlayer(playerid, 1977, 0.0, 0.0, 0.0, 6000.0);
		
		if (g_CustomTime == -1)
		{
			new hour, minute;
			gettime(hour, minute);
			
			SetPlayerTime(playerid, hour, minute);
		}
		else SetPlayerTime(playerid, g_CustomTime, 0);
		
		SetPlayerWeather(playerid, g_Weather);
		
		ClearChat(playerid);
		SetPlayerColor(playerid, -1);
		
		TogglePlayerSpectating(playerid, true);
		SetTimerEx("SetCamera", 250, false, "d", playerid);
		
		mysql_format(g_MySQL, query, sizeof(query), "SELECT `ID`, `Password`, `Salt` FROM `accounts` WHERE `Name` = '%s' LIMIT 1", GetName(playerid));
		mysql_tquery(g_MySQL, query, "OnPlayerQueryFinished", "dd", playerid, QUERY_ACCOUNT_CHECK);
		
		print("sending query");
	}
	else SpawnPlayer(playerid);
	return 1;
}
It puts player in spectating mode, sets the camera, weather, time, etc like it's supposed to, but it doesn't print any of the messages nor it does send the query. It connects successfully to the database and I got crashdetect, but it doesn't say anything. Nothing in the MySQL log as well. What's up?

EDIT: I tried the older gamemode and it didn't work as well so I assume there's nothing to do with the code...


Re: some parts not working at OnPlayerRequestClass - oMa37 - 22.02.2017

Check your custom functions (such as ClearChat as I have seen) make sure you don't have any returns in it, Used to have a similar issue like this before with a SendMessageToAdmins custom function.


Re: some parts not working at OnPlayerRequestClass - GoldenLion - 22.02.2017

It doesn't even print "called" that is above everything. Also I edited the post saying that the older version of the gamemode doesn't work as well so I don't think it's something wrong with the code.

EDIT: Fixed. I needed #pragma dynamic here.