This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

how i can make cvar?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-09-2010 , 12:17   how i can make cvar?
Reply With Quote #1

hi everybody i very much want to know how i can make a cvar i give an example

set_user_health(id, 250)

how i can make cvar for this?
Leon_12 is offline
Send a message via Skype™ to Leon_12
outsiderlv
Senior Member
Join Date: Mar 2010
Old 11-09-2010 , 12:21   Re: how i can make cvar?
Reply With Quote #2

PHP Code:
new cHealth 
and
PHP Code:
cHealth register_cvar("health_set""250"
By default the cvar will be 250, but it can be changed thru console.
outsiderlv is offline
issen1
Member
Join Date: Jan 2010
Old 11-09-2010 , 12:24   Re: how i can make cvar?
Reply With Quote #3

And you can retrieve the value with the get_pcvar_* functions:
http://www.amxmodx.org/funcwiki.php?...cvar&go=search
__________________
greets (:
issen1 is offline
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-09-2010 , 12:36   Re: how i can make cvar?
Reply With Quote #4

thanks now i know how i can make cvars and this very help me with my scripting level
Leon_12 is offline
Send a message via Skype™ to Leon_12
SaM.ThE.MaN
Senior Member
Join Date: Jan 2010
Old 11-09-2010 , 12:45   Re: how i can make cvar?
Reply With Quote #5

well , it is better if you call them
PHP Code:
new cvar_cHealth 
and
PHP Code:
cvar_cHealth register_cvar("health_set""250"
So you would understand which one is a cvar and which one is not.. Its not necessary to use cvar_ , but it is better for your own understanding .
__________________
  • Project : Level Plugin
o [||||||||||] - 100%
  • Project : OnePieceMod
o [||||||||||] - 20%
SaM.ThE.MaN is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 11-09-2010 , 12:50   Re: how i can make cvar?
Reply With Quote #6

PHP Code:
#include <amxmodx>
#include <fun>

new g_health

public plugin_init() 
{
    
g_health register_cvar("health_amount""10000000")
    
register_clcmd("say test""function")
}
    
public function(
id)
    
set_user_health(idget_pcvar_num(g_health)) 
Vechta is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-09-2010 , 19:53   Re: how i can make cvar?
Reply With Quote #7

Quote:
Originally Posted by SaM.ThE.MaN View Post
well , it is better if you call them
PHP Code:
new cvar_cHealth 
and
PHP Code:
cvar_cHealth register_cvar("health_set""250"
So you would understand which one is a cvar and which one is not.. Its not necessary to use cvar_ , but it is better for your own understanding .
Umm . . . I don't think using cvar_ would be better for a beginner because the cvar_cHealth is not actually a cvar itself. Rather, it is a pointer to a cvar. I would use something like g_pHealth (global pointer)
__________________
fysiks 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 11:49.


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