PDA

View Full Version : Including inside a callback.


Seifspeed
06/07/2018, 04:45 PM
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;
}

Verc
06/07/2018, 04:47 PM
Call a function instead or use y_hooks

Seifspeed
06/07/2018, 04:48 PM
Call a function instead.

And and put the includes inside it?

Seifspeed
06/07/2018, 05:01 PM
Does anyone now why this doesn't work?

Verc
06/07/2018, 05:02 PM
And and put the includes inside it?

Include on top of your script just like normal.

Inside yourmap.pwn

RemoveBuilding(playerid)
{
RemoveBuildingForPlayer(...
//etc.
}

Call it in onplayerconnect.

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

Seifspeed
06/07/2018, 07:21 PM
Include on top of your script just like normal.

Inside yourmap.pwn

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.