Raised This Month: $ Target: $400
 0% 

client_print variable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-28-2009 , 07:56   client_print variable
Reply With Quote #1

I want to print a variable in client_print. I read some around at http://amxmodx.org/doc/ but the %s and %d stuff confuses me and I see no reference to any variable. Could someone explain this to me?

Code:
client_print(0, print_center, "**DEBUG** there are currently ## bots")

Last edited by Otsegolectric!; 02-28-2009 at 08:06.
Otsegolectric! is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 02-28-2009 , 08:12   Re: client_print variable
Reply With Quote #2

Hi.
%s - String.
Example:
PHP Code:
new szString32 ]
formatszStringsizeof szString ) - 1"String Phrase" )
client_print0print_chat"This is your phrase: %s"szString 
%d or %i - Integer / cell.
Example:
PHP Code:
new iValue 1
client_print
0print_chat"This is your Integer: %d"iValue 
or
PHP Code:
new szString32 ]
formatszStringsizeof szString ) - 1"1" )
client_print0print_chat"This is your Integer: %d"str_to_num szString ) ) 

Last edited by TheRadiance; 02-28-2009 at 08:14.
TheRadiance is offline
Send a message via ICQ to TheRadiance
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-28-2009 , 08:40   Re: client_print variable
Reply With Quote #3

Thanks.
Otsegolectric! is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-28-2009 , 10:13   Re: client_print variable
Reply With Quote #4

Quote:
Originally Posted by Otsegolectric! View Post
Thanks.
If you want to print a float (decimal number) use %f

PHP Code:
new Float:fNum 1.24;
client_printid print_chat "number is %f" fNum ); 
__________________
Bugsy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-28-2009 , 14:00   Re: client_print variable
Reply With Quote #5

There is a full list of these in a thread that I remember arkshine and myself talking about them.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 03-01-2009 , 01:39   Re: client_print variable
Reply With Quote #6

this one?

http://www.cplusplus.com/reference/c...io/printf.html
Mlk27 is offline
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 03-01-2009 , 08:18   Re: client_print variable
Reply With Quote #7

Yeah I figured that.

I needed this for a float-cvar zm_botskill (yes im editing the zombiemod for ts):

PHP Code:
server_cmd("addcustombot Zombie Zombies %f"get_pcvar_float(cvar_botskill)) 
Otsegolectric! is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 03-01-2009 , 09:10   Re: client_print variable
Reply With Quote #8

Quote:
Originally Posted by Bugsy View Post
If you want to print a float (decimal number) use %f

PHP Code:
new Float:fNum 1.24;
client_printid print_chat "number is %f" fNum ); 
Also you can limit the number of digits to show up after the decimal point like so:
PHP Code:
new Float:float 0.45;
client_print(0print_chat"Float's value is: %.1f"float);
// It will print 0.4 
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores 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 16:56.


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