SA-MP Forums Archive
Including inside a callback. - 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: Including inside a callback. (/showthread.php?tid=656067)



Including inside a callback. - Seifspeed - 06.07.2018

All the include have inside then is RemoveBuildingForPlayer functions. I don't get any errors but the removebuildings don't work. Here's my code:

Код:
public OnPlayerConnect(playerid)
{ 
	// SECTION: MAPS

	#include "../Maps/Dealerships/Bahn/Bahn_Removes.pwn"
	#include "../Maps/Dealerships/Ottos/Ottos_Removes.pwn"
	#include "../Maps/Dealerships/Shody/Shody_Removes.pwn"
	#include "../Maps/Dealerships/Wang/Wang_Removes.pwn"

	#include "../Maps/GasPumps/FlintCounty/FlintCounty_Removes.pwn"
	#include "../Maps/GasPumps/Idlewood/Idlewood_Removes.pwn"

	return 1;
}



Re: Including inside a callback. - Verc - 06.07.2018

Call a function instead or use y_hooks


Re: Including inside a callback. - Seifspeed - 06.07.2018

Quote:
Originally Posted by Verc
Посмотреть сообщение
Call a function instead.
And and put the includes inside it?


Re: Including inside a callback. - Seifspeed - 06.07.2018

Does anyone now why this doesn't work?


Re: Including inside a callback. - Verc - 06.07.2018

Quote:
Originally Posted by Seifspeed
Посмотреть сообщение
And and put the includes inside it?
Include on top of your script just like normal.

Inside yourmap.pwn
PHP код:
RemoveBuilding(playerid)
{
     
RemoveBuildingForPlayer(...
     
//etc.

Call it in onplayerconnect.

I more recommend you to use y_hooks as it's much easier


Re: Including inside a callback. - Seifspeed - 06.07.2018

Quote:
Originally Posted by Verc
Посмотреть сообщение
Include on top of your script just like normal.

Inside yourmap.pwn
PHP код:
RemoveBuilding(playerid)
{
     
RemoveBuildingForPlayer(...
     
//etc.

Call it in onplayerconnect.

I more recommend you to use y_hooks as it's much easier
Thanks man. I used the code you gave me for my scenario but it kept on giving me errors. I had to add public in front of the function and forward it.