Raised This Month: $ Target: $400
 0% 

print_chat commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-25-2010 , 03:47   print_chat commands
Reply With Quote #1

Hello i am making a plugin and in one tutorial i found commands like ^n, %i etc. I know what means ^n, but i don't know others could anyone make a list of these and say how to use them and what is they for? Thanks in advace
macas5 is offline
Send a message via Skype™ to macas5
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-25-2010 , 03:53   Re: print_chat commands
Reply With Quote #2

Please anyone feel free to correct me, but I believe:

Some Examples:
%f = Float value = 0.000000
%.2f = 0.00
%.3f = 0.000

%s = String = "Wuzzup!"
%i = Integer = 4
%d = Data (I think this can be used universally, should show string/integer/floats)
--------------------
Usually you use these when formatting some type of string, as in for a message related to usually health, name, steamid, and other generated information.
Say you want to display the client id and steamid of a user, you would need to do...

Code:
new s[32]; get_user_authid(id,s,sizeof(s)); new msg[64]; format(msg,sizeof(msg),"ID: %i, SteamID: %s",id,s);
__________________


Last edited by mysticssjgoku4; 05-25-2010 at 03:56.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-25-2010 , 04:13   Re: print_chat commands
Reply With Quote #3

Thanks just as i wanted theres left one question. Where you writed
Quote:
format(msg,sizeof(msg),"ID: %i, SteamID: %s",id,s);
do variables (id, s) go in order, or somehow bind it?
macas5 is offline
Send a message via Skype™ to macas5
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 05-25-2010 , 09:24   Re: print_chat commands
Reply With Quote #4

In order, the first %i is represented by the first variable after the "", in this case, ID...The second is represented by the second variable, in this case S...And so on
As far as I know, %d = %i = integer ( not sure about that )
also, for client_print you can use
PHP Code:
client_print(idprint_chat""ID: %iSteamID: %s", id, s); 
And as I know:
^n = new line
^t = TAB spacing

Now if I'm right, in Pawn you can use the characters from c++ language like
Code:
\n	newline
\r	carriage return
\t	tab
\v	vertical tab
\b	backspace
\f	form feed (page feed) // I don't think you will find it in pawn
\a	alert (beep) // neither this one
\'	single quote (')
\"	double quote (")
\?	question mark (?)
\\	backslash (\)
using ^ instead of \ so it will be
Code:
^n	newline
^r	carriage return
^t	tab
^v	vertical tab
^b	backspace
^f	form feed (page feed)
^a	alert (beep)
^'	single quote (')
^"	double quote (")
^?	question mark (?)
^\	backslash (\)
Or you could use
PHP Code:
#define ctrlchar '\' 
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!

Last edited by Brreaker; 05-25-2010 at 09:38.
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-25-2010 , 10:26   Re: print_chat commands
Reply With Quote #5

I tried to make
Code:
new menu= menu_create("Choose where to spend points. You currently have %i points", "pts_handler", playerpts[id])
But i still get "Choose where to spend points. You currently have %i points" without getting a playerpts[id] number. Help
macas5 is offline
Send a message via Skype™ to macas5
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-25-2010 , 13:23   Re: print_chat commands
Reply With Quote #6

Quote:
Originally Posted by macas5 View Post
I tried to make
Code:
new menu= menu_create("Choose where to spend points. You currently have %i points", "pts_handler", playerpts[id])
But i still get "Choose where to spend points. You currently have %i points" without getting a playerpts[id] number. Help
Link to menu_create
http://www.amxmodx.org/funcwiki.php?go=func&id=798
Code:
menu_create ( title[], handler[], ml=0 )

Link to format
http://www.amxmodx.org/funcwiki.php?go=func&id=49
Code:
format ( output[], len, const format[], ... )

Ahh, see unforunately you cannot use that function "menu_create" to format a string. So you would have to do something like..
Code:
new szTitle[64]; format(szTitle,sizeof(szTitle),"Choose where to spend points. You currently have %i points",playerpts[id]); new menu = menu_create(szTitle, "pts_handler");

Hope this helps!
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
macas5
Member
Join Date: Aug 2008
Location: Lithuania
Old 05-25-2010 , 14:14   Re: print_chat commands
Reply With Quote #7

And again mysticssjgoku4 saves the day! Thank you very much
macas5 is offline
Send a message via Skype™ to macas5
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 05-25-2010 , 15:35   Re: print_chat commands
Reply With Quote #8

np =)
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
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 05:23.


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