Condition on cvar
Suppose a plugin has a cvar which is turned on for eg. "bullet_dmg 1".
Is it possible to check this cvar in another plugin? Like if bullet_dmg is 1 show a message to admin |
Re: Condition on cvar
You can also consider the xvar natives
PHP Code:
|
Re: Condition on cvar
Quote:
Code:
#include <amxmodx> |
Re: Condition on cvar
From a psuedo-code perspective it looks fine, you are retrieving the cvar pointer from an existing cvar at plugin_cfg() and using it in your menu callback. Is it not working? Did you debug at all by console/server printing the get_pcvar_num() return value?
|
Re: Condition on cvar
Quote:
Code:
public plugin_init() |
Re: Condition on cvar
If you register the cvar in the same plugin, your original question is out of point. You're not using a cvar from a different plugin if you register it again in this one. Make sure the cvar name is correct and the value is really the one you need.
|
Re: Condition on cvar
get_cvar_pointer() returns the same value that register_cvar() would return, except it uses an existing CVAR instead of creating new. What I provided is the correct way, you must have implemented it incorrectly.
|
Re: Condition on cvar
A cvar created by another plugin isn't guaranteed to exist in plugin_init() of a different plugin. Generally, you register cvars in plugin_init() and get cvar pointers in plugin_cfg() so that you know that the cvar is created prior to trying to retrieve the cvar pointer.
|
| All times are GMT -4. The time now is 02:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.