Multilple parameters - 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: Multilple parameters (
/showthread.php?tid=235988)
Multilple parameters -
Kwarde - 06.03.2011
Hi!
I have a little question about parameters. You have for example the "format" thing.
There you can do:
format(*, *, *, PARAM, PARAM, PARAM)
Well, alot of parameters. The native is "{Float,_}:..."
I'd like to make something like this too, with the "RemovePlayerWeapon" function. Examples:
RemovePlayerWeapon(playerid, 29);
OR
RemovePlayerWeapon(playerid, 29, 39, 1

;
etc...
How do I have to do this? I tried something, but it didn't work, and I don't really know it no more. I tried
{Float,_}:weaponid and
{Text3D,_}:weaponid. This is the function I have right now:
pawn Код:
stock RemovePlayerWeapon(playerid, {Float,_}:weaponid)
{
new WepInfo[13][2], CurWeap = GetPlayerWeapon(playerid);
for(new i = 0; i < 13; i++)
GetPlayerWeaponData(playerid, i, WepInfo[i][0], WepInfo[i][1]);
ResetPlayerWeapons(playerid);
for(new i = 0; i < 13; i++)
{
if(WepInfo[i][0] != weaponid)
GivePlayerWeapon(playerid, WepInfo[i][0], WepInfo[i][1]);
}
return 1;
}
Thanks in advance.
- Kevin
Re: Multilple parameters -
Hiddos - 06.03.2011
Doing a quick scan, I found this (old) tutorial:
https://sampforum.blast.hk/showthread.php?tid=77000
I hope it provides some usefulness to you ^^
Re: Multilple parameters -
Kwarde - 06.03.2011
Okay I'll read it
Re: Multilple parameters -
Kwarde - 07.03.2011
Yep it worked

Thank you.
pawn Код:
stock RemovePlayerWeapon(playerid, {_}:...)
{
new pWepInfo[13][2], pCurWep, WepID,
ammount = numargs()
;
pCurWep = GetPlayerWeapon(playerid);
for(new i = 0; i < 13; i++)
GetPlayerWeaponData(playerid, i, pWepInfo[i][0], pWepInfo[i][1]);
ResetPlayerWeapons(playerid);
for(new i = 1; i < ammount; i++){
WepID = getarg(i);
for(new w = 0; w < 13; w++)
if(pWepInfo[w][0] == WepID)
pWepInfo[w][0] = 0;
}
for(new i = 0; i < 13; i++)
GivePlayerWeapon(playerid, pWepInfo[i][0], pWepInfo[i][1]);
SetPlayerArmedWeapon(playerid, pCurWep);
}