Modular gamemode includes
#1

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)
Reply
#2

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
Reply
#3

why can`t i use includes?i am currently doing that and it works.
Reply
#4

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
Reply
#5

People already had a discussion about modular programming here: https://forum.sa-mp.com/showthread.p...hlight=modular
Reply
#6

i have read that topic but i couldnt manage to find answers for my questions
Reply
#7

Quote:
Originally Posted by PepsiCola23
Посмотреть сообщение
i have read that topic but i couldnt manage to find answers for my questions
How comes ?

Everything you need is there and first answer on your question starts with ****** post.
Reply
#8

should i use .inc files or .pwn ? do i comple the .pwn or i just save it?
Reply
#9

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.
Reply
#10

Quote:
Originally Posted by polygxn
Посмотреть сообщение
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.
I said the same thing ur just now copying my answer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)