Function with optional parameters
#6

numargs shows the number of arguments
getarg gets the argument value
setarg sets the argument value

If you have a function like

pawn Код:
SetPlayerData(playerid, ...)
and you call it like this

pawn Код:
new number = 789;
SetPlayerData(playerid, 45, 1235, number);
numargs() is 4
getarg(0) is playerid
getarg(1) is 45
getarg(2) is 1235
getarg(3) is 789 (because number = 789)
setarg(3, 0, 123) sets 'number' to 123

There is also an example on the wiki

https://sampwiki.blast.hk/wiki/ResetPlayerWeaponsEx
Reply


Messages In This Thread
Function with optional parameters - by Miguel - 30.10.2010, 01:53
Re: Function with optional parameters - by Cameltoe - 30.10.2010, 02:10
Re: Function with optional parameters - by Miguel - 30.10.2010, 02:26
Re: Function with optional parameters - by MadeMan - 30.10.2010, 11:12
Re: Function with optional parameters - by Miguel - 30.10.2010, 14:32
Re: Function with optional parameters - by MadeMan - 30.10.2010, 15:25
Re: Function with optional parameters - by Miguel - 01.11.2010, 03:45

Forum Jump:


Users browsing this thread: 1 Guest(s)