Switch statements with strings
Hi guys, I'm having trouble using a switch statement with strings.
I'm trying to get the name of the player's model, and I understand that the model name will return as the name of the model folder / model name without the file extension. I have these models set as constants set before plugin_init() like so: PHP Code:
PHP Code:
Error: Array must be indexed (variable "-unknown-") And on each of the case lines I'm getting: Error: Must be a constant expression; assumed zero Please help me solve this. Thanks! |
Re: Switch statements with strings
PHP Code:
PHP Code:
|
Re: Switch statements with strings
drekes you should test your solutions before you post them...
Strings don't work with switch. You have to use equal with ifs: PHP Code:
PHP Code:
|
Re: Switch statements with strings
Sorry I left that bit out, I actually do have:
PHP Code:
|
| All times are GMT -4. The time now is 03:34. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.