Raised This Month: $121 Target: $400
 30% 

Module: Cvar Utilities (v1.6)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2011 , 12:02   Module: Cvar Utilities (v1.6)
Reply With Quote #1



Cvar Utilities
∞ v1.6, released February 28th, 2013


Cvar Utilities provides a library of functionalities around the management of cvars.

It includes mainly :
  • Un|Hooking cvar for any value change and could be blocked ;
  • Un|Locking cvar to a specific value ;
  • Defining cvar with a minimum and maximum bound ;
  • Hooking a cvar for any value change and caching the new value in a global variable ;
The others are here to be complementary :
  • Creating a new cvar including new arguments ( description, bounds ) ;
  • Getting the default value of cvar ( value retried the first time by the module ) ;
  • Resetting a cvar to it's default value ;
  • Getting information about a hook, lock or bound ;
  • Listing cvars registered by the module and getting information ;
  • [Get|Set]ting a cvar description ;
  • Getting a cvar name from it's handle ;
  • Getting a plugin name/title from a plugin id ;
  • A command to show informations about registered cvars and module.

Contents :


HOW IT WORKS ?
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙

How the module detects when a cvar value is set ?
  • It simply hooks the engine function Cvar_DirectSet() ;
  • It's called only when a value is set, after checks and at the end of others functions.
  • In others words : that's the best way.
Code:
pfnCVarSetFloat   -> CVarSetFloat     -> Cvar_SetValue -> Cvar_Set -> Cvar_DirectSet pfnCvarSetString  -> CVarSetString    -> Cvar_Set                  -> Cvar_DirectSet pfnCvar_DirectSet -> PF_Cvar_DirectSet                             -> Cvar_DirectSet Cvar_Command                                                       -> Cvar_DirectSet

CREDITS
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙
  • Joaquim : Stolen some of his memory functions from orpheu.
  • Jim : For his way to hook a function.
  • Seta00 : For his c++ help and his patience.
  • Alka : Testing a bit v1.4 :p.

API
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙

Raw list of available natives/forwards
List

Error and return handling
List

Hooking all cvars top
Syntax

Example

[Un]Hooking a specific cvar top
Syntax

Examples

Un|Hooking all registered cvars of a plugin top
Syntax

Examples

Caching a cvar's value to a variable top
Syntax

Constants

Examples

[Un]Locking a cvar top
Syntax

Example
Registering a new cvar top
Syntax:

Spoiler

Example

[Get|Set]tting a bound top
Syntax

Example

Gettting hook infos top
Syntax

Example

Gettting lock infos top
Syntax

Example

Getting cvar status top
Syntax

Constants


Example

Getting cvar infos top
Syntax

Constants


Example

Getting cvar name top
Syntax

Example

[Get|Set]ing cvar description top
Syntax

Example

Getting plugin infos top
Syntax

Example

Getting cvar default value top
Syntax

Example

Resetting cvar top
Syntax

Example

COMMAND
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙

To retrieve useful informations or troubleshooting, a command exits to help this way : cvartutil or cu.
Usage : [cvarutil|cu] <command>

Commands :
  • version
    Display some informations about the module and where to get a support.
    example


  • status
    Display module status.
    Useful for people where the module doesn't work and they can't check the server logs. I.e :

    example


  • list
    Show a list of registered cvars which have a status.
    Can be filtered by [partial] plugin name.

    example


  • info < [cvar|index] >
    Give detailed informations about a cvar.
    example

CHANGE LOG
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙

list


INSTALLATION
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙
  1. Download cvar_util-files.zip and unzip the content directly in your $mod/ directory.
  2. Open your plugins.ini file, and add the plugin cu_amx_cvar_fix.amxx (*) before admincmds.amxx
  3. Restart and it's ready.
(*) This plugin contains the original amx_cvar command but with some modifications to check if a cvar is locked/bounded.


INSTALLATION FILES
∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙∙ ∙

cvar_util-source-xx.zip : contains the project source code.
cvar_util-files-xx.zip : contains the binaries and configuration files.


Similar features have been integrated to latest 1.8.3-dev build, this is recommenced to not use anymore this module.
Attached Files
File Type: zip cvar_util-source-1.6.zip (76.5 KB, 1685 views)
File Type: zip cvar_util-files-1.6.zip (96.2 KB, 5117 views)
__________________

Last edited by Arkshine; 01-30-2015 at 11:41. Reason: Updated to 1.5
Arkshine is offline
xPaw
AMX Mod X Moderator
Join Date: Jul 2008
Old 04-11-2011 , 12:26   Re: Cvar Utilities
Reply With Quote #2

Amazing.
__________________
xPaw is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Brazil
Old 04-11-2011 , 13:20   Re: Cvar Utilities
Reply With Quote #3

Nice job! Now go learn C++ the proper way.
Seta00 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2011 , 13:22   Re: Cvar Utilities
Reply With Quote #4

Sir, yes sir. But it's a good experience to make modules and learning from that.
__________________
Arkshine is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-11-2011 , 14:16   Re: Cvar Utilities
Reply With Quote #5

Just a small question. For what kind of plugins would be such module useful?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2011 , 14:48   Re: Cvar Utilities
Reply With Quote #6

Plugins which will need such functionalities, eh.

Look, all is fully documented with examples. You see what does the module exactly, I don't see what I could answer to such question. It's up to you, depending your need, to decide whether it will be useful for your plugins.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-11-2011 , 15:01   Re: Cvar Utilities
Reply With Quote #7

Finally !! Gj.
__________________
- tired and retired -
ConnorMcLeod is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 04-11-2011 , 16:38   Re: Cvar Utilities
Reply With Quote #8



Mind = Blown
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
Quote:
Originally Posted by bash.org
<axle345> I mean seriosuly guys holocaust jokes aren't funny
<axle345> Anne Frankly, I won't stand for it.
wrecked_ is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 04-11-2011 , 18:04   Re: Cvar Utilities
Reply With Quote #9

Quote:
] meta list
Currently loaded plugins:
description stat pend file vers src load unlod
[ 1] AMX Mod X RUN - amxmodx_mm.dll v1.8.1.3 ini Start ANY
[ 2] POD-Bot mm RUN - podbot_mm.dll v3.0B20a ini Chlvl ANY
[ 3] Fun RUN - fun_amxx.dll v1.8.1.3 pl1 ANY ANY
[ 4] Engine RUN - engine_amxx.dll v1.8.1.3 pl1 ANY ANY
[ 5] FakeMeta RUN - fakemeta_amxx.dl v1.8.1.3 pl1 ANY ANY
[ 6] CStrike RUN - cstrike_amxx.dll v1.8.1.3 pl1 ANY ANY
[ 7] CSX RUN - csx_amxx.dll v1.8.1.3 pl1 ANY ANY
[ 8] Ham Sandwich RUN - hamsandwich_amxx v1.8.1.3 pl1 ANY ANY
[ 9] Orpheu RUN - orpheu_amxx.dll v2.3 pl1 ANY ANY
[10] Cvar Utilities RUN - cvar_util_amxx.d v1.0.0 pl1 ANY ANY
10 plugi
Quote:
L 04/11/2011 - 23:03:55: [AMXX] Plugin "cvar_utilities_test.amxx" failed to load: Plugin uses an unknown function (name "CvarHookChange") - check your modules.ini
What's wrong?
bibu is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-11-2011 , 18:10   Re: Cvar Utilities
Reply With Quote #10

Check the server logs and past the output above the message "Module failed to load. Contact the author". It appears after the metamod/amxmodx message at the very start. If you still don't see the message, try to type in the console server : meta reload Cvar ; the error should appears.

But the error should be either you have not uploaded the module at the right place, or a signature has not been found. If you are sure binary is well uploaded it would be weird ; I've tested the module on the latest engine version and with hlbeta update too with success and all signatures were found.
__________________

Last edited by Arkshine; 04-11-2011 at 18:14.
Arkshine 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 12:32.


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