Help with case :/
#1

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

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

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

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)