Raised This Month: $ Target: $400
 0% 

Setting a CVAR


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-03-2012 , 10:02   Re: Setting a CVAR
Reply With Quote #1

What i want to do is set the cost of something via CVAR. -1 represents not needing to purchase (equip automatically) 0 would be free (still has to choose to equip it) and anything above that, obviously, would be the set price.

Code:
new pcvar_cost = register_cvar("Cost", 0)
if(get_pcvar_num(pcvar_cost) == -1)
     print("THAT SHIT'S FREE!")
else
     print("Fat chicks need love too....they just gotta pay.")
I'd test it myself....but i recently lost my test server due to god knows what. In the process of fixing it.....
Liverwiz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-04-2012 , 03:45   Re: Setting a CVAR
Reply With Quote #2

Quote:
Originally Posted by Liverwiz View Post
What i want to do is set the cost of something via CVAR. -1 represents not needing to purchase (equip automatically) 0 would be free (still has to choose to equip it) and anything above that, obviously, would be the set price.

Code:
new pcvar_cost = register_cvar("Cost", 0)
if(get_pcvar_num(pcvar_cost) == -1)
     print("THAT SHIT'S FREE!")
else
     print("Fat chicks need love too....they just gotta pay.")
I'd test it myself....but i recently lost my test server due to god knows what. In the process of fixing it.....
You already know what to do it sounds like. Also, your code doesn't match your words, FYI.
__________________
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-05-2012 , 08:58   Re: Setting a CVAR
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
You already know what to do it sounds like. Also, your code doesn't match your words, FYI.
I'm asking if the OP were to put -1 in as the CVAR in their amxx.cfg, would it bug out?
Liverwiz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-06-2012 , 01:28   Re: Setting a CVAR
Reply With Quote #4

Quote:
Originally Posted by Liverwiz View Post
I'm asking if the OP were to put -1 in as the CVAR in their amxx.cfg, would it bug out?
Why would it? You can always test.

cvar_name "-1"
__________________
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 00:20.


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