SA-MP Forums Archive
Cutting my GM - 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)
+---- Forum: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Cutting my GM (/showthread.php?tid=638882)



Cutting my GM - Henson - 07.08.2017

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 ?


Re: Cutting my GM - Hansrutger - 07.08.2017

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.


Re: Cutting my GM - Henson - 08.08.2017

Thank's you very much Hansrutger !

So, it's resolved now !


Re: Cutting my GM - fordawinzz - 14.08.2017

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


Re: Cutting my GM - iKarim - 15.08.2017

use backslashes \ and get Zeex's compiler fixes.


Re: Cutting my GM - IlanZ - 16.08.2017

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)


Re: Cutting my GM - Dayrion - 17.08.2017

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