30.01.2019, 09:26
You can check what weapons are not restricted and use `default` keyword to handle the error.
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.
pawn Код:
switch (wep_id)
{
case 2 .. 13, 15, 16, 18, 22 .. 39, 41, 42:
{
// foreach loop
}
default:
{
SCM(playerid, COLOR_RED, "* Invalid weapon ID.");
}
}