SA-MP Forums Archive
Help with case :/ - 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: Help with case :/ (/showthread.php?tid=266129)



Help with case :/ - FireCat - 03.07.2011

If i add this in OnGameModeInit (i want to add all skins easly)

pawn Код:
for(new i = 0; i < 299; i++)
    {
        switch(i)
        {
            case 3, 4, 5, 6, 7, 8, 42, 53, 64, 74, 86, 91, 149, 208, 273, 289:
            {
                continue;
            }
            AddPlayerClass(i, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
        }
    }
I get lots of errors.


Re: Help with case :/ - Mauzen - 03.07.2011

You cant have the AddPlayerClass code inside the switch, but outside of any case. Just moe it a bit

pawn Код:
for(new i = 0; i < 299; i++)
    {
        switch(i)
        {
            case 3, 4, 5, 6, 7, 8, 42, 53, 64, 74, 86, 91, 149, 208, 273, 289:
            {
                continue;
            }
        }
        AddPlayerClass(i, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    }



Re: Help with case :/ - FireCat - 03.07.2011

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
You cant have the AddPlayerClass code inside the switch, but outside of any case. Just moe it a bit

pawn Код:
for(new i = 0; i < 299; i++)
    {
        switch(i)
        {
            case 3, 4, 5, 6, 7, 8, 42, 53, 64, 74, 86, 91, 149, 208, 273, 289:
            {
                continue;
            }
        }
        AddPlayerClass(i, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    }
Oh x) ok fixed now :b


Re: Help with case :/ - Kyosaur - 03.07.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Oh x) ok fixed now :b
You should read up on switch/case statements a bit more. I think the default operator will greatly benefit you.

https://sampwiki.blast.hk/wiki/Keywords:Statements#case