Raised This Month: $ Target: $400
 0% 

Setting a CVAR


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Kreation
Veteran Member
Join Date: Jan 2010
Location: Illinois
Old 05-02-2012 , 21:24   Re: Setting a CVAR
Reply With Quote #3

Quote:
Originally Posted by Bilal Pro View Post
Yes you can, for example

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Example"
#define VERSION "1.0"
#define AUTHOR "Bilal"

new Xp
new Player_XP[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)

    
Xp register_cvar("test_xp""1")
    
register_clcmd("say /test""CmdGive")
}

public 
CmdGive(id)
{
    if (
is_user_connected(id)
    {
        
Player_XP[id] -= get_pcvar_num(Xp)
        
client_print(idprint_chat"You have decreased %d xp!"get_pcvar_num(Xp))
    }

That doesn't go with his question at all..

@fysiks: I think he is referring to -1 as the cvar, then getting the cvar and will it still return -1.

So:

Code:
#include <amxmodx> new pCvar; public plugin_init() {     pCvar = register_cvar("your_cvar", "-1");     func(); } public func() {     new iValue;         iValue = get_pcvar_num(pCvar);         client_print(0, print_chat, "Your cvar value is %i", iValue); }

Although, I'm not sure if it will default it to 0 or not.
__________________
Hi.
Kreation is offline
 



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 00:20.


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