SA-MP Forums Archive
HowDoIMakeThis(playerid); - 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: HowDoIMakeThis(playerid); (/showthread.php?tid=432415)



HowDoIMakeThis(playerid); - NicholasA - 22.04.2013

In the regular samp scripting you have things like SetPlayerSkin(playerid, 1); but how can I make my own?
Like PutObjectInFrontOfPlayer(playerid, objectid);
You don't need to do the scripting, i just want to know how to a function


Re: HowDoIMakeThis(playerid); - DanLore - 22.04.2013

pawn Код:
// "playerFunction" is the name of the function; you can freely change this.

forward playerFunction(playerid);
public playerFunction(playerid)
{
    // whatever you want the function to do
}
Or, you can use a stock

pawn Код:
stock playerFunction(playerid)
{
    // whatever you want the function to do
}



Re: HowDoIMakeThis(playerid); - Knappen - 22.04.2013

******, what do you mean with that neither of those are what most functions should be? If you don't mind me asking! : )


Re: HowDoIMakeThis(playerid); - MP2 - 22.04.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Most functions are just regular undectorated functions:

pawn Код:
MyFunc(a)
{
}
No need for "public" or "stock" etc.
I just PMed you regarding this, but perhaps it'd be better public (so others can learn):

Is it advised to NOT use 'stock' when you know the function will definately be used?

The only reason I use 'stock' is if I want to edit the contents of a function I can Ctrl+F for 'stock BlahBlah'. If the function name has no prefixed keyword - it'd be a lot harder to find it if it's used many times in the script you're Ctrl+F'ing in.


Re: HowDoIMakeThis(playerid); - Knappen - 22.04.2013

Oh, right! I thought you were thinking of something else

One quick question though, if you make a function like this,

pawn Код:
MyFunc(a)
{
}
say, for example in an include. Will it always be included in your gamemode, even if you don't use it? Because I know stocks get excluded from your gamemode if they are not used. This does not really matter, it's just because I'm curious!


Re: HowDoIMakeThis(playerid); - MP2 - 22.04.2013

If a stock makes it NOT included, clearly NOT including the stock will do the OPPOSITE.