SA-MP Forums Archive
Include? - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Include? (/showthread.php?tid=241688)



Include? - sciman001 - 18.03.2011

Ok, just in general... how do i create an include? ex. missles or something like that. THANKZ!!!


Re: Include? - Markx - 18.03.2011

Hmm dunno xD


Re: Include? - sciman001 - 18.03.2011

well... then y u reply? thanks... i guess.


Re: Include? - Kyosaur - 18.03.2011

Quote:
Originally Posted by Markx
Посмотреть сообщение
Hmm dunno xD
Honestly, why did you bother posting this? If your aim was laughs, you succeeded, i LOLD pretty hard. Its pretty annoying as well though!



Anyways, an include is just code that is included into another file. To make it, you would just go about coding as you normally would, but the thing about includes is they're sectioned off by the #section directive, so all global variables should be declared "static" so they keep their values (Also its a good idea to precede the global variables with "g_" so people dont get issues due to your var naming...example: static g_VariableName; ).

If you plan on using callbacks in the include you'll also need to use callback hooks, and thanks to Mr.****** that is VERY easy! Its literally one line, and is the fastest method yet. Read about it here: https://sampforum.blast.hk/showthread.php?tid=241446

But yes, other than using globals/callbacks, code exactly how you normally would.


Re: Include? - sciman001 - 18.03.2011

ok...


Re: Include? - sciman001 - 18.03.2011

But what if i wanted to add a new function?


Re: Include? - Kyosaur - 18.03.2011

Quote:
Originally Posted by sciman001
Посмотреть сообщение
But what if i wanted to add a new function?
You would create the function in the include, it is that simple. A big thing about includes is you have to make sure you dont cause the user trouble, so callback hooks, appropriate variable naming, and declaring your functions as "stock" is very important.


If you dont know what stock is, basically its a way to declare things so that if it isnt used, the compiler wont include it. This is ideal for things like includes cause you dont want to give the users warnings regarding one of your functions not being used! You can declare variables as stock as well, for more information check the sa-mp wiki about it.


Re: Include? - sciman001 - 18.03.2011

ok. maybe ill wait t start making includes... kinda complex...


Re: Include? - Kyosaur - 18.03.2011

Quote:
Originally Posted by sciman001
Посмотреть сообщение
ok. maybe ill wait t start making includes... kinda complex...
Thats the best way to do it man, just jump into it! Start small and get a good idea of how it works, and build your way up.


If you need any help, feel free to PM me. I'll try to answer all your questions (as long as i have time/im not busy of course).


Re: Include? - Markx - 18.03.2011

What means "y" -.-