How tO make an include ?
#1

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

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)");
}
Reply
#3

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

Example
Reply
#5

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

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)