Raised This Month: $ Target: $400
 0% 

Invisible CVAR.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lonely
Junior Member
Join Date: Oct 2006
Old 01-24-2007 , 02:55   Invisible CVAR.
Reply With Quote #1

Good day.
The question is:
Is there a way to have something like invisible (outside the plugin) cvar?
I mean, that even admin with ADMIN_CVAR access could not have the access to this cvar. But cvar, like others, must store his value via mapchange.

In simple words:
We must have a cvar, but its value can only be changed within the plugin.
Lonely is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 01-24-2007 , 03:40   Re: Invisible CVAR.
Reply With Quote #2

Just make a CVAR and cache it in plugin_init()

Code:
new myCvarValue; public plugin_init() {     register_plugin(...);         register_cvar("myCvar", "1");     myCvarValue = get_cvar_num("myCvar"); }
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Lonely
Junior Member
Join Date: Oct 2006
Old 01-24-2007 , 03:45   Re: Invisible CVAR.
Reply With Quote #3

But i can change the myCvar via amx_cvar. And after mapchange myCvarValue will be changed too.
Lonely is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-24-2007 , 03:51   Re: Invisible CVAR.
Reply With Quote #4

Let a variable act like a cvar...
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
Lonely
Junior Member
Join Date: Oct 2006
Old 01-24-2007 , 04:33   Re: Invisible CVAR.
Reply With Quote #5

Quote:
Originally Posted by dutchmeat View Post
Let a variable act like a cvar...
???
Variable will be redefined each mapchange. But she must store its value, and plugin, by itself, can change this value.

new var1=1
...//deep in plugin
var1=0
...//after mapchange
new var1=1 //again! Var1 is now 1, but must be 0.
Lonely is offline
KoST
Senior Member
Join Date: Jul 2005
Old 01-24-2007 , 04:43   Re: Invisible CVAR.
Reply With Quote #6

click here

Code:
FCVAR_SPONLY        This cvar cannot be changed by clients connected to a multiplayer server.
__________________
KoST is offline
Lonely
Junior Member
Join Date: Oct 2006
Old 01-24-2007 , 04:50   Re: Invisible CVAR.
Reply With Quote #7

Quote:
Originally Posted by KoST View Post
click here

FCVAR_SPONLY This cvar cannot be changed by clients connected to a multiplayer server.
But can be viewed via amx_cvar. Or not?


Just tried FCVAR_SPONLY. This flag has no effect. I still can change cvar via amx_cvar.

Last edited by Lonely; 01-24-2007 at 05:06.
Lonely is offline
Simon Logic
Senior Member
Join Date: Nov 2006
Location: RF
Old 01-24-2007 , 06:30   Re: Invisible CVAR.
Reply With Quote #8

Quote:
Originally Posted by Lonely
We must have a cvar, but its value can only be changed within the plugin.
Try to use a global var and store its value in external file. Try to update it as less as possible (e.g. before map restart).
Simon Logic is offline
Send a message via Skype™ to Simon Logic
Lonely
Junior Member
Join Date: Oct 2006
Old 01-24-2007 , 07:57   Re: Invisible CVAR.
Reply With Quote #9

Quote:
Originally Posted by Simon Logic View Post
Try to use a global var and store its value in external file.
Good decision, i made it. It works now. Thanks
Lonely 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 22:27.


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