AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invisible CVAR. (https://forums.alliedmods.net/showthread.php?t=50332)

Lonely 01-24-2007 02:55

Invisible CVAR.
 
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.

MaximusBrood 01-24-2007 03:40

Re: Invisible CVAR.
 
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"); }

Lonely 01-24-2007 03:45

Re: Invisible CVAR.
 
But i can change the myCvar via amx_cvar. And after mapchange myCvarValue will be changed too.

dutchmeat 01-24-2007 03:51

Re: Invisible CVAR.
 
Let a variable act like a cvar...

Lonely 01-24-2007 04:33

Re: Invisible CVAR.
 
Quote:

Originally Posted by dutchmeat (Post 430952)
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.

KoST 01-24-2007 04:43

Re: Invisible CVAR.
 
click here

Code:

FCVAR_SPONLY        This cvar cannot be changed by clients connected to a multiplayer server.

Lonely 01-24-2007 04:50

Re: Invisible CVAR.
 
Quote:

Originally Posted by KoST (Post 430959)
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.

Simon Logic 01-24-2007 06:30

Re: Invisible CVAR.
 
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).

Lonely 01-24-2007 07:57

Re: Invisible CVAR.
 
Quote:

Originally Posted by Simon Logic (Post 430976)
Try to use a global var and store its value in external file.

Good decision, i made it. It works now. Thanks :)


All times are GMT -4. The time now is 22:27.

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