Posts
517
Respect
165Add +1
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!case statements are only allowed within a switch block.
- Phil.
Like this:
EDIT: Really i'd just suggest an if statement instead of a case statement for what your trying to do. Case statements are primarily used as a way to return values, not do lengthy code.
No, nothing wrong with that more than likely. But make sure you add a default case statement. Most likely why that is happening is there is a value being returned that is not listed down.
Well, then I have no idea what's wrong. I don't know how I should correct the script myself. D: I can't see anything wrong with it.
Like said, it 'switches' to the value returned and executes the code. Let's say you have the case for 'm9' and 'thompson'. If you carry any other gun, presumably it'd pop out an error or do nothing. If it IS popping out an error, you have to add a default case so that if it isn't one of the listed guns it's execute the code in the default case.
C# Switch Example (Top box)
Not very good at scripting, but..
You call this
But the function is this
Shouldn't it be
because it switches to the m9 inside of the function itself?