AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_cvar and create_cvar (https://forums.alliedmods.net/showthread.php?t=276364)

luxor 12-20-2015 05:51

register_cvar and create_cvar
 
What are the differences between register_cvar and create_cvar ?
Is create_cvar better to use ?
Is register_cvar deprecated ?

zmd94 12-20-2015 06:07

Re: register_cvar and create_cvar
 
Just visit below to learn more:

1. http://www.amxmodx.org/api/cvars/create_cvar
2. http://www.amxmodx.org/api/cvars/register_cvar

luxor 12-20-2015 07:20

Re: register_cvar and create_cvar
 
i still don't understand
register_cvar : Registers a new cvar for the engine.
create_cvar : Creates a new cvar for the engine.
what is the difference ?

Arkshine 12-20-2015 07:28

Re: register_cvar and create_cvar
 
The difference is create_cvar has more arguments, allowing you to provide a description and enabling a minimum/maximum value.

If you know about it, it's my Cvar Utilities module integrated to AMXX in a more sane way.

As side-note, providing at least a description is useful if you're using AutoExecConfig, which generates a config file per plugin with cvar value/description/bounds.
Exemple

luxor 12-20-2015 08:39

Re: register_cvar and create_cvar
 
Quote:

Originally Posted by Arkshine (Post 2374346)
The difference is create_cvar has more arguments, allowing you to provide a description and enabling a minimum/maximum value.

If you know about it, it's my Cvar Utilities module integrated to AMXX in a more sane way.

As side-note, providing at least a description is useful if you're using AutoExecConfig, which generates a config file per plugin with cvar value/description/bounds.
Exemple

ok, now i see
but in api it's a note, and that note says : "Deprecated. Consider to use create_cvar for more options.", then if it's deprecated why we can still use ? i mean.. look at client_disconnect, it's practically deprecated, not just theoretically like register_cvar. (#pragma deprecated Use client_disconnected() instead.)
may i create a pull request to fully deprecate the register_cvar and use create_cvar on amxx plugins ?

Arkshine 12-20-2015 09:30

Re: register_cvar and create_cvar
 
There is no issue with register_cvar. Saying deprecated is just to encourage coder to include description. The case with client_disconnect is because there is an actual issue using it

JusTGo 12-20-2015 10:15

Re: register_cvar and create_cvar
 
Quote:

Originally Posted by Arkshine (Post 2374373)
There is no issue with register_cvar. Saying deprecated is just to encourage coder to include description. The case with client_disconnect is because there is an actual issue using it

i never faced issues with client_disconnect is there is a way to reporduce it ?

Arkshine 12-20-2015 10:30

Re: register_cvar and create_cvar
 
https://github.com/alliedmodders/amxmodx/pull/264

fysiks 12-20-2015 16:15

Re: register_cvar and create_cvar
 
There is nothing inherently wrong with register_cvar() so it's confusing that you create a new alternate function. Maybe since it is an augmentation of registering cvar, the name should be an augmentation of the existing function (e.g. format and formatex).

WildCard65 12-20-2015 18:24

Re: register_cvar and create_cvar
 
Quote:

Originally Posted by fysiks (Post 2374568)
There is nothing inherently wrong with register_cvar() so it's confusing that you create a new alternate function. Maybe since it is an augmentation of registering cvar, the name should be an augmentation of the existing function (e.g. format and formatex).

Maybe he went with "create_cvar" because it's params match that of SM's CreateConVar native(only difference is the name and that param flags is before description)


All times are GMT -4. The time now is 18:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.