If cvar is enabled, hide /custom command
Hello,
I am creating a plugin with /custom command with cvars. I created a cvar that can hide or display /custom command but I always get an error: Warning: Function should return a value on line 65. What I want to do is: IF cvar is enabled, hide /custom command and do the action. IF cvar is disabled, show /custom command and do the action. Even with a warning, my plugin works. But I don't want it to display any warning. Thank you. |
Re: If cvar is enabled, hide /custom command
Okay. I solved the problem. I will write here how so I can help others.
If you have any return PLUGIN_HANDLED_MAIN; or return PLUGIN_HANDLED (I guess) as a cvar, you MUST add return PLUGIN_CONTINUE; in the end of public blabla(id) { |
Re: If cvar is enabled, hide /custom command
Another question is:
if cvar (string) has no input, if it's empty, client_print(id,print_chat,"Custom message"); but if cvar has some input I want to print just that input. |
Re: If cvar is enabled, hide /custom command
Example : "Type /menu to see game menu." will be shown as ( in chat) : "Type" with cvar : Code:
Code:
|
Re: If cvar is enabled, hide /custom command
Space works in cvars.
Create a big enough string in your function that can get all the cvar string and use get_pcvar_string to copy it there. Check string's length to see if it has anything in it ( "strlen( your_string )" ) and print either the string or your custom message (through client_print, like LearninG's sample) |
Re: If cvar is enabled, hide /custom command
Quote:
Code:
amx_message Type /menu to see game menuCode:
amx_message "Type /menu to see game menu" |
Re: If cvar is enabled, hide /custom command
Thank you guys. I will try that.
Is it possible to add IF cvar1 = something AND cvar2 = something { do this } |
Re: If cvar is enabled, hide /custom command
|
| All times are GMT -4. The time now is 17:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.