Float Cvar Tag mismatch Warning
I have a float variable for setting a delay for set_task:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
how to avoid tag mismatch warning for a float cvar? |
Re: Float Cvar Tag mismatch Warning
Change to the following:
PHP Code:
PHP Code:
PHP Code:
|
Re: Float Cvar Tag mismatch Warning
You can also consider using floatclamp(), to ensure the cvar is between a min/max.
PHP Code:
|
Re: Float Cvar Tag mismatch Warning
Quote:
|
Re: Float Cvar Tag mismatch Warning
I think you should look at how the return value of register_cvar() actually works. Find some approved plugins that use this return value. Hint: it is a cvar pointer.
|
Re: Float Cvar Tag mismatch Warning
That because u have stored a pointer in a float variable , Look at this : register_cvar
u can see at the end of the page that register_cvar doesn't return any float or int value , it returns an <address/pointer> that shouldn't be stored or handled by a float variable . PHP Code:
PHP Code:
PHP Code:
Summary : - Each Existing CVAR has a value and has a unique pointer . - Value of Cvar might be (integer , float , or string) PHP Code:
PHP Code:
PHP Code:
-Value of a Value should also return the Value itself . -Value of a Pointer OR Pointer of a Value will Cuze problems (so try to avoid this) : PHP Code:
|
Re: Float Cvar Tag mismatch Warning
thank you, brothers, specially @101, I reduced about 6 warnings,
but still there is another warning: PHP Code:
|
Re: Float Cvar Tag mismatch Warning
Quote:
it is just something STRANGE that <points at the float value> and <its not the float value itself> . it looks like this : RespawnDelay ☞ float (it contains an address inside and not a value , it just tracks the float value by carrying its address , So it should not be treated as float or int) its something totally different . BTW , you can use this instead : PHP Code:
PHP Code:
according to these documentations : https://www.amxmodx.org/api/cvars/set_cvar_float set_pcvar_float is faster and more efficient . RespawnDelay ☞ float value |
Re: Float Cvar Tag mismatch Warning
This is why I said you should learn how the pointer for cvars actually work. I you learn the reason behind how they work, you'll have less issues and be able to create plugins better and quicker.
Here is an existing tutorial about cvars: https://forums.alliedmods.net/showthread.php?t=85316. Also, as stated before, you can look at existing plugins to see how to use some of these functions. Also, here is a list of a bunch of tutorials that you may want to search when you're having issues with your own code: https://forums.alliedmods.net/showthread.php?t=172936. |
Re: Float Cvar Tag mismatch Warning
Quote:
This function doesn't work as desire , it seems like get_pcvar_float( RespawnDelay ) return a fake value or a copy of the original value so <floatclamp>won't be able to restrict the actual float value of the given cvar between 5.0 and 30.0 . BTW , I think that RespawnDelay is a pointer while floatclamp return a float value that shouldn't be stored in a pointer . After many retries , I now realized that floatclamp(Float:X , min , max) does't change the actual value of X , it just checks : * if X in between mix and max THEN return X . * if X > max THEN return max . * if X < min THEN return min . PHP Code:
PHP Code:
Regrads |
All times are GMT -4. The time now is 16:31. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.