How to get actual cvar name
cvar = register_cvar("very_cool_cvar", "1")
I know that I can get the "1" with get_pcvar_num, but is it possible to get the string "very_cool_cvar"? |
Re: How to get actual cvar name
Are you banned on google ?
https://www.amxmodx.org/api/cvars/get_pcvar_string |
Re: How to get actual cvar name
Quote:
|
Re: How to get actual cvar name
i think you need this :
Quote:
|
Re: How to get actual cvar name
You should explain what are you really trying to achieve, because getting name is usually not useful.
|
Re: How to get actual cvar name
I came up with the idea of making a CS Essentials plugin, inspired by the one used in Minecraft. If you're not familiar with it, the plugin has a bunch of commands that use special permissions, for example "essentials.tphere" (this permission allows you to use the "/tphere" command). In order to achieve something similar, I register every permission as a cvar and add an admin flag to it - register_cvar("essentials.tphere", "d"). So, when the user doesn't have the required flag, I want to make a chat message that will say "Insufficent permissions ( essentials.tphere ). Isn't there a simple way of doing this?
|
Re: How to get actual cvar name
You will have to use get_plugins_cvar/nums() so to loop over all cvars, checking by handle, then saving the cvar name.
In 1.8.3, I did added first a get_pcvar_name, but removed later because could not find any usefulness in it. Could add a stock using above natives, or reintroducing get_pcvar_name, don't know. |
Re: How to get actual cvar name
I'd rather make it like this for now:
PHP Code:
PS: Is something like this possible? PHP Code:
PHP Code:
|
Re: How to get actual cvar name
A period (.) is not a valid word character, is it a valid character for cvars?
|
Re: How to get actual cvar name
Cvars are strings, therefore I see no reason for it to be invalid, nor I'm having any problems with it.
|
| All times are GMT -4. The time now is 22:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.