Modular scripting question related to hooks
#1

Hello,

So I am making a modular gamemode, I have my #includes sorted in the appropriate order and every .pwn has an ongamemodehook to tell me if its properly included but the output is not in the same order as my #includes list.

My console output:
Код:
core/player/textdraws.pwn loaded
core/player/dialogs.pwn loaded
core/player/login.pwn loaded
core/admin/functions.pwn loaded
core/server/anticheat.pwn loaded
core/server/economy.pwn loaded
core/server/stocks.pwn loaded
core/timers/onesecond.pwn loaded
core/server/textdraws.pwn loaded
core/server/publics.pwn loaded
core/admin/bans.pwn loaded
core/player/playerdata.pwn loaded
core/factions/factiondata.pwn loaded
core/faction/commands.pwn loaded
While my #includes are in this order:
Код:
//Server
#include "core/server/textdraws.pwn"
#include "core/server/publics.pwn"

//Admin
#include "core/admin/bans.pwn"

//Player
#include "core/player/data.pwn"

//Factions
#include "core/factions/data.pwn"
#include "core/factions/commands.pwn"

//Player

#include "core/player/textdraws.pwn"
#include "core/player/dialogs.pwn"
#include "core/player/login.pwn"

//Admin
#include "core/admin/functions.pwn"

//Vehicles

//Server (with player data variables)
#include "core/server/anticheat.pwn"
#include "core/server/economy.pwn"
#include "core/server/stocks.pwn"

//Timers
#include "core/timers/onesecond.pwn"
Does the console order matter? Why does it load not the same as the script order?
Reply
#2

Includes are not actually loaded within .amx. Their code is. Console's order does not thing any thing bad but only that include was loaded first than other, Like even though ban is included before OneSecond, OneSecond include code was added before Ban. Probably because function requiring OneSecond was called before Ban's members or simply, Ban was longer to read than OneSecond. So while Ban was still getting read, other smaller includes got included first.
Reply
#3

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Includes are not actually loaded within .amx. Their code is. Console's order does not thing any thing bad but only that include was loaded first than other, Like even though ban is included before OneSecond, OneSecond include code was added before Ban. Probably because function requiring OneSecond was called before Ban's members or simply, Ban was longer to read than OneSecond. So while Ban was still getting read, other smaller includes got included first.
Aha but upon compiling it maintains the list of #includes? Because I cant have some stuff compiling in a different order else it fucks up
Reply
#4

Quote:
Originally Posted by Stefand
Посмотреть сообщение
Aha but upon compiling it maintains the list of #includes? Because I cant have some stuff compiling in a different order else it fucks up
Upon compiling, all codes (And I mean all declarations and functions) of Includes which are used for GM, will be added to .amx. Dont worry nothing will get messed up. Thats the way Pawn compiler works. When you include a code, it will be stacked above the main GM's files, I dont think It would mess up anything.
Reply
#5

Alright thanks mate.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
What sort of hooks?
Код:
==========core/vehicles/data.pwn file===========
#include <YSI\y_hooks>

hook OnGameModeInit()
{
	print("core/vehicles/data.pwn loaded");
}

==========core/player/data.pwn file===========
#include <YSI\y_hooks>

hook OnGameModeInit()
{
	print("core/player/data.pwn loaded");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)