Multilple parameters
#1

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

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

Okay I'll read it
Reply
#4

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);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)