include issue
#7

Even tho i don't like modular scripting, when you reach almost 1000+ dynamic objects in your map, you can't put them all in a single gamemode.

Would be confusing and stupid. So i work in this way:

Main gamemode:

pawn Код:
#include "/Objects/bank.pwn"
In bank.pwn:

pawn Код:
stock CreateBankObjects()
{
//Code objects
}
Then, on the main gamemode, at OnGameModeInit:

pawn Код:
CreateBankObjects();
To call them.

That's how i do. Another example, random spawns:

This is LEO's random spawn coordinates:

pawn Код:
new Float:RandomCopSpawns[][4]=
{
//Coordinates
}
And again on main gamemode, to call them:

pawn Код:
new randi = random(sizeof(RandomCopSpawns));
SetPlayerPos(playerid, RandomCopSpawns[randi][0],RandomCopSpawns[randi][1],RandomCopSpawns[randi][2]);
Hope you got the idea.

I just noticed a thing (tho i don't need to do it), if in a separate .pwn you put any default callback (such as OnPlayerConnect, OnPlayerDeath and so on.) and meantime you have that callback in your main gamemode, script won't compile because callback X is already defined.

However don't need this. I use external .pwn files just to store stocks, custom callbacks, objects and everything NOT related to default Sa-Mp callbacks. Then i call them in my gamemode whenever i want.
Reply


Messages In This Thread
include issue - by YenTy - 08.10.2018, 18:13
Re: include issue - by YenTy - 13.10.2018, 16:35
Re: include issue - by v1k1nG - 13.10.2018, 16:41
Re: include issue - by YenTy - 13.10.2018, 16:49
Re: include issue - by YenTy - 13.10.2018, 17:44
Re: include issue - by YenTy - 13.10.2018, 18:44
Re: include issue - by KinderClans - 13.10.2018, 19:25
Re: include issue - by YenTy - 13.10.2018, 19:50
Re: include issue - by YenTy - 15.10.2018, 14:25

Forum Jump:


Users browsing this thread: 5 Guest(s)