SA-MP Forums Archive
Question about includes - 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)
+--- Thread: Question about includes (/showthread.php?tid=356264)



Question about includes - Gryphus One - 02.07.2012

Hi, I'm making my own includes with my own custom functions, so when I script a gamemode I just use #include as always, and then I just call those functions wherever I want to. The thing is, I want some of those functions to be called only in some specific callbacks and nowhere else. Is there any way I can write the include so those functions will be called automatically in the callback I want, without having to manually add a line in that callback to call the function? For example, imagine that I have an include named "my_include", which has a function named "MyFunction". Now imagine that I want that function to be called in OnPlayerSpawn, and in no other callback than that. What I'm currently doing is writing #include <my_include> in my gamemode, and then adding MyFunction(playerid); in OnPlayerSpawn. How can I make it so just writing #include <my_include> will be enough?


Re: Question about includes - Vince - 02.07.2012

ALS callback hooking. Search for that.


Respuesta: Re: Question about includes - Gryphus One - 02.07.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
ALS callback hooking. Search for that.
Thank you.
I have just found this: https://sampforum.blast.hk/showthread.php?tid=85907 but seems a bit hard, doesn't it?


Respuesta: Question about includes - Gryphus One - 02.07.2012

I think I have already solved it, thank you Vince, +1 rep.