![]() |
#1 |
Huge Clucker
![]() ![]() ![]() Join Date: Dec 2007
Posts: 281
Reputation: 25
|
![]()
numargs, setarg and getarg
setarg and getarg are functions default in sa-mp. With this functions you can create a custom function with infinite parameters. To create a function like this, you need to use this as a parameter: pawn Code:
You want for example that users can type ex. a Float, and a number. Then you need: pawn Code:
pawn Code:
pawn Code:
pawn Code:
So, you put your kind of variables that need to be accepted between the 2 brackets. But now, the functions. Their natives: pawn Code:
numargs and getarg Here's a example command: pawn Code:
Explanation: pawn Code:
pawn Code:
ex. pawn Code:
pawn Code:
pawn Code:
setarg setarg is used to set a argument. Example function: pawn Code:
ex. pawn Code:
Explanation: pawn Code:
0 = Later used for arrays and stings 15 = the value to set. Use setarg and getarg with arrays and strings String is the same as an array actually, because every item of the string will be set to a number. that number will be converted to a char by the system. ex: pawn Code:
Watch the fourth index of the array. It's set to 0 because every string needs to end with that. It's kind a string ended symbol. An array is an group of integers together. So you can use pawn Code:
pawn Code:
You can use this: pawn Code:
End of the tutorial Try to experiment with these 3 functions, use this as a guide (do not take over the examples, but learn from them) Why i wrote this Because i searched almost 3 months a tutorial how to use these functions, i finally found it out to looking in the sscanf code created by y_less. And i wanted to help others. Help to make this tutorial better Is there something that i didn't mention, or do i explained something wrong. I am open for suggestions. |
![]() |
![]() |
![]() |
#2 |
Gangsta
![]() ![]() ![]() ![]() Join Date: Dec 2007
Location: Greece, Athens
Posts: 759
Reputation: 14
|
![]()
Nice guide! Ill start using it.
|
![]() |
![]() |
![]() |
#3 | |
Huge Clucker
![]() ![]() ![]() Join Date: Dec 2007
Posts: 281
Reputation: 25
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#4 | ||
Gangsta
![]() ![]() ![]() ![]() Join Date: Dec 2007
Location: Greece, Athens
Posts: 759
Reputation: 14
|
![]() Quote:
Like i sad, this function only allows the type Menu: to be filled in. |
||
![]() |
![]() |
![]() |
#5 | |||
Huge Clucker
![]() ![]() ![]() Join Date: Dec 2007
Posts: 281
Reputation: 25
|
![]() Quote:
|
|||
![]() |
![]() |
![]() |
#6 |
Gangsta
![]() ![]() ![]() ![]() Join Date: Dec 2007
Location: Greece, Athens
Posts: 759
Reputation: 14
|
![]()
Also all proccesed are with one "c" and two "s"
This is the start of the loop. It's 1 because we don't need the playerid to be proccesed. <--- processed |
![]() |
![]() |
![]() |
#7 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2006
Posts: 2,002
Reputation: 6
|
![]()
Those are functions of the Pawn language, not of SA:MP..
|
![]() |
![]() |
![]() |
#8 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jul 2008
Posts: 1,300
Reputation: 0
|
![]()
Yeah, hence they don't need the <a_samp> (I think).
Why: pawn Code:
Why not: pawn Code:
|
![]() |
![]() |
![]() |
#9 | |
Huge Clucker
![]() ![]() ![]() Join Date: Dec 2007
Posts: 281
Reputation: 25
|
![]() Quote:
|
|
![]() |
![]() |
![]() |
#10 |
Little Clucker
![]() Join Date: May 2009
Posts: 13
Reputation: 0
|
![]()
REALLY BIG THANX!!!!
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
getarg with OnTimerEx bug? | Bpb | Help Archive | 2 | 08/10/2009 01:05 PM |