How to include same file few times? - 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: How to include same file few times? (
/showthread.php?tid=477572)
How to include same file few times? -
theYiin - 24.11.2013
I would like to do some "clever" but pretty easy macros, to initiate variables from all includes, and then after all variables are collected, define functions.
for example:
Player.pwn:
pawn Код:
#if defined INIT_VARIABLES
enum ePlayer{ pa, pb, pc };
new player[MAX_PLAYERS][ePlayer];
#else
stock LoadPlayer(playerid) { return 1; }
stock PlayerHaveJob(playerid) { return player[playerid][pa]; }
#endif
Jobs.pwn:
pawn Код:
#if defined INIT_VARIABLES
enum eJobsList { ja, jb, jc };
new jobs[eJobsList];
#else
stock HirePlayer(playerid, jobid)
{
if(!PlayerHaveJob(playerid) && player[playerid][pb])
player[playerid][pa] = jobid;
}
#endif
Includes.pwn:
pawn Код:
#include "Player.pwn"
#include "Jobs.pwn"
Main.h:
pawn Код:
#include <a_samp>
#define INIT_VARIABLES
#include "Includes.pwn"
Main.pwn:
pawn Код:
#include "Main.h"
#undef INIT_VARIABLES
#include "Includes.pwn" // this is not called
main(){}
AW: How to include same file few times? -
Nero_3D - 24.11.2013
use #undef _inc_filename at the beginning of each file you want to include more as once like #undef _inc_main or #undef _inc_includes
although I dont see a reason here to do that
Re: AW: How to include same file few times? -
theYiin - 24.11.2013
Quote:
Originally Posted by Nero_3D
use #undef _inc_filename at the beginning of each file you want to include more as once like #undef _inc_main or #undef _inc_includes
although I dont see a reason here to do that
|
found solution, come here to say that and found you message

thx anyway
More information:
http://forum.sa-mp.com/showpost.php?...3&postcount=35