Cutting my GM
#1

Hello,

I want to cut my GM in different folders, and put this in my principal GM file with include (like "#include "XXX\filename.pwn")

How I can do that ? With filterscripts or different folders in \gamemode ?
Reply
#2

Anyone else wanted to post a picture of a knife?

Easiest way I found was through y_hooks but you don't actually need it to divide your gamemode, just in case you want to use the callbacks. Example from my own gamemode:

I have a file called script.pwn which will call everything. Inside it is my main scripting components as well as the callbacks (which with y_hooks will be called last). This is the file which I compile and receive an .amx, which is later on connected in the configuration file.

First thing I do in my script.pwn is to include any global variables and all functions. Out of bad naming I chose to call my "global variable" file name to be "enum.pwn". After it I include any feature files for instance like the list below:
Код:
#include "enums.pwn"
#include "functions.pwn"

#include "Features\items.pwn"
#include "Features\mdc.pwn"
#include "Features\apb.pwn"

#include "Features\Misc\weapondamages.pwn"
And so on forth. Remember that global variables should always be first as what you are doing with "cutting gamemode" is to simply reduce the file size.
Reply
#3

Thank's you very much Hansrutger !

So, it's resolved now !
Reply
#4

idk why but when I try including 2 files only the 1st file content will work in the gm. does anybody know why? eg:
pawn Код:
#include "../include/admin_commands/level_1.pwn"
#include "../include/admin_commands/level_2.pwn"
only level_1.pwn content will work
Reply
#5

use backslashes \ and get Zeex's compiler fixes.
Reply
#6

Use modules makes this very easy.

Create the modules folder in the folder on the server.

Then create a .pwn file or a .inc file (I think it goes with .inc ) and boat at the beginning of gm.

Код:
#include ".. \ modules \ script.pwn"
You can put folders from other folders in the module that the procedure is the same, and to use the callbacks inside them use y_hooks from YSI, I highly recommend!

(If that's not what you want, sorry)
Reply
#7

Mine is like :
Код:
#include "..\includes\ServerName/core/faction/save"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)