SA-MP Forums Archive
Pawno stopped working - 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: Pawno stopped working (/showthread.php?tid=421843)



Pawno stopped working - newbienoob - 11.03.2013

I scripted something that will give a random weapons to players. But, my pawno crashes while compiling the script.

pawn Код:
stock GiveRandomWeapons(playerid, slot)
    {
        new slot0weapons[] = {1};
        new rand0 = random(sizeof(slot0weapons));
       
        new slot1weapons[] = {
            2,3,4,5,6,7,8,9
        };
        new rand1 = random(sizeof(slot1weapons));
       
        new slot2weapons[] = {
            22,23,24
        };
        new rand2 = random(sizeof(slot2weapons));
       
        new slot3weapons[] = {
            25,26,27
        };
        new rand3 = random(sizeof(slot3weapons));
       
        new slot4weapons[] = {
            28,29,32
        };
        new rand4 = random(sizeof(slot4weapons));
       
        new slot5weapons[] = {
            30,31
        };
        new rand5 = random(sizeof(slot5weapons));
       
        new slot6weapons[] = {
            33,34
        };
        new rand6 = random(sizeof(slot6weapons));
       
        new slot8weapons[] = {
            16,18,39
        };
        new rand8 = random(sizeof(slot8weapons));
       
        new slot9weapons[] = {
            41,42
        };
        new rand9 = random(sizeof(slot9weapons));
       
        new slot10weapons[] = {
            10,11,12,13,14,15
        }};
        new rand10 = random(sizeof(slot10weapons));

        new weap,ammo;
        GetPlayerWeaponData(playerid,slot,weap,ammo);
        switch(slot)
        {
            case 0:
            {
                GivePlayerWeapon(playerid,slot0weapons[rand0],inf);
            }
            case 1:
            {
                GivePlayerWeapon(playerid,slot1weapons[rand1],inf);
            }
            case 2:
            {
                GivePlayerWeapon(playerid,slot2weapons[rand2],inf);
            }
            case 3:
            {
                GivePlayerWeapon(playerid,slot3weapons[rand3],inf);
            }
            case 4:
            {
                GivePlayerWeapon(playerid,slot4weapons[rand4],inf);
            }
            case 5:
            {
                GivePlayerWeapon(playerid,slot5weapons[rand5],inf);
            }
            case 6:
            {
                GivePlayerWeapon(playerid,slot6weapons[rand6],inf);
            }
            case 8:
            {
                GivePlayerWeapon(playerid,slot8weapons[rand8],inf);
            }
            case 9:
            {
                GivePlayerWeapon(playerid,slot9weapons[rand9],inf);
            }
            case 10:
            {
                GivePlayerWeapon(playerid,slot10weapons[rand10],inf);
            }
        }
        return 1;
    }
What did I do wrong?


Re: Pawno stopped working - Scrillex - 11.03.2013

You had
pawn Код:
new slot10weapons[] = {
            10,11,12,13,14,15
        }};
Just change it to:
pawn Код:
new slot10weapons[] = {
            10,11,12,13,14,15
        };



Re: Pawno stopped working - newbienoob - 11.03.2013

Ahh.. stupid mistake :P Thanks. It's working now.


Re: Pawno stopped working - Scrillex - 11.03.2013

All okay.. Thats why always morning is smarter then evening