Thread: Menu help
View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-13-2024 , 17:04   Re: Menu help
Reply With Quote #2

Quote:
Originally Posted by tedaimlocks View Post
I made this, it works perfectly fine but i get a warning when compiling it

pvipshop.sma(35) : warning 209: function "PVIPMenu" should return a value

Could anyone help?
This warning is saying that you a explicitly returning a value in some but not all possible cases of code execution. This exists because there is, generally, a very good chance that you are creating unknown behavior of your code. All possible executions of a function should have an explicit return value. So, in this case, you return a value in the if statement at the beginning of the function but if that if statement doesn't get executed i.e. the menu is created and displayed, then there is no explicit return value. To fix this, you should either add a "return PLUGIN_CONTINUE" or "return PLUGIN_HANDLED" at the end of the function depending on how you want the function to behave. For chat commands like this, PLUGIN_CONTINUE will allow the original chat command to be shown to other players like a normal chat message but PLUGIN_HANDLED will suppress this message (i.e. your function gets executed but nobody sees who used the command).


Quote:
Originally Posted by WATCH_D0GS UNITED View Post
..
This is Scripting Help, people are here to learn. Explain what is actually wrong. It's not really helpful if you just post a plugin without any explanation.
__________________
fysiks is offline