Raised This Month: $ Target: $400
 0% 

Getting cvar's num


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-15-2011 , 15:51   Getting cvar's num
Reply With Quote #1

Hello, guys!
So I have a menu and some cvars. I was wondering how can the text in the menus get_pcvar_num(mycvar).

Here is what I want:
menu_additem(menu, "\wMoney Cost - %s$", "1", 0);
I tried with
menu_additem(menu, "\wMoney Cost - %s$", "1", 0, get_pcvar_num(mycvar));
but it didnt compile. Help please!
dreamedward is offline
Nyuszy
Senior Member
Join Date: Apr 2009
Old 08-15-2011 , 15:53   Re: Getting cvar's num
Reply With Quote #2

new temp[65]
formatex(temp, 64, "\wMoney Cost - %s$", get_pcvar_num(mycvar))
menu_additem(menu, temp, "1", 0)
Nyuszy is offline
dreamedward
Senior Member
Join Date: Aug 2010
Location: ZombieWorld
Old 08-15-2011 , 17:20   Re: Getting cvar's num
Reply With Quote #3

Thanks man!
dreamedward is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-16-2011 , 22:15   Re: Getting cvar's num
Reply With Quote #4

Use %d for numbers ! %s is for strings, %f for float, and search for the rest if you're curious.

Also, if you want to know if a function accepts format parameters, search it on funcwiki and see it's accepted arguments, usually indicated by "..." like here: http://www.amxmodx.org/funcwiki.php?go=func&id=22
__________________

Last edited by Hunter-Digital; 08-16-2011 at 22:18.
Hunter-Digital is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-16-2011 , 22:16   Re: Getting cvar's num
Reply With Quote #5

I like to search for "printf" @ cplusplus.com for a general reference. I do the same for fopen too.
__________________
fysiks 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 09:11.


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