SA-MP Forums Archive
Creating a function [ Need help ] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Creating a function [ Need help ] (/showthread.php?tid=170631)



Creating a function [ Need help ] - Cameltoe - 23.08.2010

How would i make an function with optional parameters?

pawn Код:
forward Scm(playerid, color, Message[], OPTIONAL PARAMETER HERE);
public Scm(playerid, color, Message[], OPTIONAL PARAMETER HERE)
{
     return 1;
}



Re: Creating a function [ Need help ] - iggy1 - 23.08.2010

Assign the param a value like
pawn Код:
Scm(playerid, color, Message[], OPTIONAL_PARAMETER = 1)
Then if you dont enter it its 1 anway.


Re: Creating a function [ Need help ] - Cameltoe - 23.08.2010

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Assign the param a value like
pawn Код:
Scm(playerid, color, Message[], OPTIONAL_PARAMETER = 1)
Then if you dont enter it its 1 anway.
Yeah ofc! thanks!


Re: Creating a function [ Need help ] - iggy1 - 23.08.2010

Your welcome i was wondering this myself the other day and looked at some includes thats why the fast reply lol