Raised This Month: $ Target: $400
 0% 

register_cvar and create_cvar


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
luxor
Member
Join Date: Jan 2014
Old 12-20-2015 , 05:51   register_cvar and create_cvar
Reply With Quote #1

What are the differences between register_cvar and create_cvar ?
Is create_cvar better to use ?
Is register_cvar deprecated ?
luxor is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-20-2015 , 06:07   Re: register_cvar and create_cvar
Reply With Quote #2

Just visit below to learn more:

1. http://www.amxmodx.org/api/cvars/create_cvar
2. http://www.amxmodx.org/api/cvars/register_cvar
zmd94 is offline
luxor
Member
Join Date: Jan 2014
Old 12-20-2015 , 07:20   Re: register_cvar and create_cvar
Reply With Quote #3

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 ?
luxor is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-20-2015 , 07:28   Re: register_cvar and create_cvar
Reply With Quote #4

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
__________________

Last edited by Arkshine; 12-20-2015 at 07:32.
Arkshine is offline
luxor
Member
Join Date: Jan 2014
Old 12-20-2015 , 08:39   Re: register_cvar and create_cvar
Reply With Quote #5

Quote:
Originally Posted by Arkshine View Post
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 ?
luxor is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-20-2015 , 09:30   Re: register_cvar and create_cvar
Reply With Quote #6

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
__________________
Arkshine is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 12-20-2015 , 10:15   Re: register_cvar and create_cvar
Reply With Quote #7

Quote:
Originally Posted by Arkshine View Post
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 ?
__________________
JusTGo is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-20-2015 , 10:30   Re: register_cvar and create_cvar
Reply With Quote #8

https://github.com/alliedmodders/amxmodx/pull/264
__________________
Arkshine is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-20-2015 , 16:15   Re: register_cvar and create_cvar
Reply With Quote #9

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).
__________________
fysiks is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 12-20-2015 , 18:24   Re: register_cvar and create_cvar
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
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)

Last edited by WildCard65; 12-20-2015 at 18:24.
WildCard65 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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