SA-MP Forums Archive
How tO make an 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)
+--- Thread: How tO make an include ? (/showthread.php?tid=535522)



How tO make an include ? - rockhopper - 04.09.2014

I just want to know how to make a include and do includes Help in scripting ? And How to make it For example I wanna make my function in my include That is SendClientMessage I wanna make this SCM in include how do i do it ?


Re: How tO make an include ? - Stinged - 04.09.2014

Well it's just like normal gamemodes/filterscripts, but you just hook the functions so they don't get called twice.
For example:
pawn Код:
#include <YSI\y_hooks>

/*
native Function(playerid);
*/


#define SCM SendClientMessage

hook OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, -1, "This was sent from an include!");
}

stock Function(playerid)
{
    return SendClientMessage(playerid, color, "This was called using Function(playerid)");
}



Re: How tO make an include ? - rockhopper - 04.09.2014

So This will come in my include ? So if I #include <myinclude> Then I can use Function right ?


Re: How tO make an include ? - View - 04.09.2014

Example


Re: How tO make an include ? - Stinged - 04.09.2014

Yes you can rockhopper.
Also, I hooked OnPlayerConnect and sent a message inside of it, just as an example, you can of course remove it.
It was just to show you that it works.


Re: How tO make an include ? - rockhopper - 04.09.2014

Now YOu think Im making a include Of Short Forms So In my include I will add
#define SCM SendClientMessage
OR
stock SCM(playerid,text)
{
new text[500];
SendClientMessage(playerid,text);
return 1;
}

And I Include My include im my GM And Then I can use SCM right ?


Re: How tO make an include ? - Stanford - 04.09.2014

You can do stocks too for example: INCLUDE_NAME_UnderOnGameModeinit();

and add it for example under OnGameModeinit. it will be fine.

and about your SCM question if you did "#include <ur include name>" before defining the SCM thing it will show up errors, but if you added the include after the defintion it might not show errors.
Good luck.