Question Info: Function, [...] is correct ? - SOLVED
#5

Quote:
Originally Posted by Speed++
Посмотреть сообщение
EDIT:

Don't work...

PHP код:
GivePlayerWeapons(playerid, ...) 

    new 
        
start 1
        
num numargs(); 
    for(new 
startnumi++) 
    { 
        
GivePlayerWeapon(playeridgetarg(i), getarg(1)); 
    } 
    return 
1

use...

PHP код:
GivePlayerWeapons(playerid912640046450); // Chainsaw, Sawnoff Shotgun & Tec-9 
give me a parachute, Brass Knuckles, Chainsaw, Sawnoff Shotgun, Tec-9

the syntax is:

PHP код:
GivePlayerWeapons(playeridweapon_1ammo_1weapon_2ammo_2weapon_3ammo_3); 
etc
pawn Код:
GivePlayerWeapons(playerid, ...)
{
    new
        start = 1,
        num = numargs();
    for(new i = start; i < num; i+= 2)
    {
        GivePlayerWeapon(playerid, getarg(i), getarg(i + 1));
    }
    return 1;
}
Problem was you would need to increment the index by 2 every time the loop iterates, as you need to jump an extra argument ahead to get to the next weapon.

Hope that helps.
Reply


Messages In This Thread
Question Info: Function, [...] is correct ? - SOLVED, Thanks. - by Speed++ - 27.06.2012, 14:07
Re: Question Info: Function, [...] is correct ? - by JaTochNietDan - 27.06.2012, 14:12
Re: Question Info: Function, [...] is correct ? - by Speed++ - 27.06.2012, 14:16
Re: Question Info: Function, [...] is correct ? - SOLVED - by Speed++ - 28.06.2012, 23:35
Re: Question Info: Function, [...] is correct ? - SOLVED - by JaTochNietDan - 28.06.2012, 23:48

Forum Jump:


Users browsing this thread: 1 Guest(s)