SA-MP Forums Archive
Looping through 2D variable - 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)
+--- Thread: Looping through 2D variable (/showthread.php?tid=409080)



Looping through 2D variable - Income - 20.01.2013

Hey there!

I'm trying to create a command that will give you some specific weapons (their ID's).
I'm having a problem that the pawno does't recognize the var and I don't know why..
What am I doing wrong here? Am I coding the variable wrong?

PHP код:
CMD:spawnweapons(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= && Logged[playerid])
    {
        new 
weaponlist[] = { 242731343543 };
        for(new 
0sizeof(weaponlist); i++) //<- line 2413
        
{
            
GivePlayerWeapon(playeridi10010);
        }
        
GameTextForPlayer(playerid,"~w~Weapons ~g~Gained"50001);
    }
    else return 
SendErrorMessage(playeridERROR_ADMIN);
    return 
1;

PHP код:
GameModes.pwn(2413) : warning 204symbol is assigned a value that is never used"weaponlist" 



Re: Looping through 2D variable - Vince - 20.01.2013

It does recognize it alright, it just tells you that you created a variable but didn't use it.

pawn Код:
GivePlayerWeapon(playerid, i, 10010);
That will just give the player weapons with ids 0 through 5. Not the ones that you specified.

pawn Код:
GivePlayerWeapon(playerid, weaponlist[i], 10010);



Re: Looping through 2D variable - Income - 20.01.2013

I understand my mistake. Silly me hehe
Thank you very much!