Raised This Month: $51 Target: $400
 12% 

version cvars questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kwski43
Senior Member
Join Date: Mar 2009
Old 05-11-2010 , 07:51   version cvars questions
Reply With Quote #1

I know it looks nooby but I always want to ask before fail.
1. When I use code like:
Code:
#define PLUGIN_VERSION "1.1"
(...)
cvarPluginVersion = CreateConVar("version", PLUGIN_VERSION, "Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
(...)
AutoExecConfig(true, "awesome");
and it creates config with version cvar 1.1 then i will change version in plugin with version 1.2 which version will be set for this cvar? 1.1 or 1.2?
Whats a difference when I add:
Code:
SetConVarString(cvarPluginVersion, PLUGIN_VERSION);
after AutoExecConfig, it basically can set the new version number to the cvar, right?

2. How to do not include version cvar in cfg file? (ye, I know there is answer somewhere) -not sure but adding "FCVAR_NOTIFY" flag only to version cvar does it?
Code:
#define PLUGIN_VERSION "1.1"
(...)
cvarPluginVersion = CreateConVar("version", PLUGIN_VERSION, "Version", FCVAR_NOTIFY);
(...)
AutoExecConfig(true, "awesome");
as only "FCVAR_NOTIFY" is required for version cvars?
search.php was blocked by public computer. so forgive me.
__________________

Last edited by kwski43; 05-11-2010 at 07:59.
kwski43 is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 05-11-2010 , 15:28   Re: version cvars questions
Reply With Quote #2

when you change PLUGIN_VERSION, the cvar will be set on compile.. its mostly just a simple and easy way to update the version (instead of scrolling down to the createconvar command).

you dont need a setconvarstring, at least not for plugin version.. if your using it AFTER the createconvar command, the value is already set - and static, if your using it BEFORE, the convar doesnt exist yet.

use FCVAR_DONTRECORD if you dont want it in the autoconfig.

i believe NOTIFY reports when the cvar is changed - which version doesnt.
dirka_dirka is offline
kwski43
Senior Member
Join Date: Mar 2009
Old 05-12-2010 , 03:14   Re: version cvars questions
Reply With Quote #3

Thanks
__________________
kwski43 is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 05-12-2010 , 07:47   Re: version cvars questions
Reply With Quote #4

Also note that you should use a unique name for that cvar.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 05-12-2010 , 12:42   Re: version cvars questions
Reply With Quote #5

oh yeah, version isnt a very good name to choose.

including your plugin into it is better:
my_plugin_version
dirka_dirka is offline
kwski43
Senior Member
Join Date: Mar 2009
Old 05-12-2010 , 12:46   Re: version cvars questions
Reply With Quote #6

I already knew it before I asked my questions lol
__________________
kwski43 is offline
LumiStance
AlliedModders Donor
Join Date: Jan 2009
Location: Northern California
Old 05-17-2010 , 14:27   Re: version cvars questions
Reply With Quote #7

Quote:
Originally Posted by dirka_dirka View Post
use FCVAR_DONTRECORD if you dont want it in the autoconfig.
Where is that documented? The API reference has "Don't record these command in demo files."
__________________
LumiStance is offline
dirka_dirka
Veteran Member
Join Date: Nov 2009
Old 05-17-2010 , 15:55   Re: version cvars questions
Reply With Quote #8

the first time i saw it was in another plugin.
the api says what you quoted, but it is a flag of createconvar..

and, it does prevent cvars from showing up in the autoconfig.

i just made a comment under CreateConVar about it. so in the future people will know.
dirka_dirka is offline
LumiStance
AlliedModders Donor
Join Date: Jan 2009
Location: Northern California
Old 05-18-2010 , 01:15   Re: version cvars questions
Reply With Quote #9

Thanks. I've been fighting with this for a while and ended up putting a create and set convar in OnConfigsExecuted().

But I did see that FCVAR_DONTRECORD does work in a test plugin I made.
__________________
LumiStance is offline
Reply



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 02:30.


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