Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
So basically im starting to make my gamemode modular, i have my textdraws,objects and removed building and other stuff in a include called objects.inc.
When i add objects,i simply put them in objects.inc,i save and then i compile my gamemode.
My question is,if i wanna make a system into an include,like a pet system,how do i make it so i can use variables from the gamemode into the include? like PlayerInfo and other stuffs i hope you get it.
can i simply use the variables or should i do something?
also can i use mysql in includes and how would i do that? ( cmds that modify data in database)
Posts: 214
Threads: 31
Joined: Oct 2018
Reputation:
0
No no no... You can't use includes for that. Just make file objects.pwn in your gamemodes folder. Then put your object inside it and just save it do not compile. Go to your main gamemode and put the #include < objects.pwn > after the a_samp include. And then compile the main. If there's errors in that include your main gamemode compiler will show them. And the same thing for that pets
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
why can`t i use includes?i am currently doing that and it works.
Posts: 214
Threads: 31
Joined: Oct 2018
Reputation:
0
It is not supposed for that, but you are too looking to a way to use variables from gm in that and Iam not 100% sure but I think it is possible in my way
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
i have read that topic but i couldnt manage to find answers for my questions
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
should i use .inc files or .pwn ? do i comple the .pwn or i just save it?
Posts: 100
Threads: 11
Joined: Dec 2018
Use .pwn of course. You need to have your main .pwn file in /gamemodes/, and include all the systems and such there, for example if you have a fishing system in /gamemodes/other_stuff/fishing_system.pwn then add the line #include "other_stuff/fishing_system.pwn" after where a_samp included. This way you can keep your mode fairly snappier. Here is a topic about modular programming more in-depth:
https://sampforum.blast.hk/showthread.php?tid=597338
You need to use some of the stuff from
THIS if you want to do such things.