HowDoIMakeThis(playerid);
#1

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

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

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

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)