Command help
#6

You can check what weapons are not restricted and use `default` keyword to handle the error.
pawn Код:
switch (wep_id)
{
    case 2 .. 13, 15, 16, 18, 22 .. 39, 41, 42:
    {
        // foreach loop
    }
    default:
    {
        SCM(playerid, COLOR_RED, "* Invalid weapon ID.");
    }
}
Another thing to consider is format the text before the loop and not re-format it as many times as the online players. It is the same with variables declaration. If an invalid weapon was given, it creates a string for no reason.
Reply


Messages In This Thread
Command help - by SymonClash - 30.01.2019, 08:56
Re: Command help - by Calisthenics - 30.01.2019, 08:59
Re: Command help - by SymonClash - 30.01.2019, 09:05
Re: Command help - by Calisthenics - 30.01.2019, 09:07
Re: Command help - by SymonClash - 30.01.2019, 09:15
Re: Command help - by Calisthenics - 30.01.2019, 09:26
Re: Command help - by SymonClash - 30.01.2019, 10:36
Re: Command help - by Calisthenics - 30.01.2019, 10:49
Re: Command help - by SymonClash - 30.01.2019, 10:58

Forum Jump:


Users browsing this thread: 4 Guest(s)