Raised This Month: $ Target: $400
 0% 

Native Text Formatting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-16-2009 , 05:22   Native Text Formatting
Reply With Quote #1

.sma:
Code:
public plugin_natives()         register_native("AddMsg", "_AddMsg", 1);   public _AddMsg(Cl, Msg[], any:...) {         new Txt[128];         vformat(Txt, 127, Msg, 2);           set_hudmessage(blabla);         show_hudmessage(Cl, Txt); }
.inc:
Code:
native AddMsg(Cl, Msg[], any:...);
Other .sma:
Code:
public SomeFunc(Cl) {         new Name[32];         get_user_name(Cl, Name, 31);           AddMsg(Cl, "Test %s", Name); }
It shows some shit like %)(/)D in-game. Why?
__________________
hleV is offline
hzqst
Senior Member
Join Date: Jul 2008
Old 06-16-2009 , 05:25   Re: Native Text Formatting
Reply With Quote #2

public _AddMsg(Cl, Msg[], any:...)

this : "_"
hzqst is offline
znovit
Member
Join Date: Mar 2009
Location: Behind you :=
Old 06-16-2009 , 06:33   Re: Native Text Formatting
Reply With Quote #3

as you probably can see he wants that underline;

Code:
register_native("AddMsg", "_AddMsg", 1);
__________________

Last edited by znovit; 06-16-2009 at 06:36.
znovit is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-16-2009 , 06:44   Re: Native Text Formatting
Reply With Quote #4

Try this
PHP Code:
public _AddMsgiPluginiParams ) {
    new 
szText128 ];
    new 
Cl get_param);
    
get_string2szTextcharsmaxszText ) );
    
    
set_hudmessage(blabla);
    
show_hudmessage(ClszText);

__________________
xPaw is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-16-2009 , 13:36   Re: Native Text Formatting
Reply With Quote #5

Code:
/*
 * Same as vformat(), except works in normal style dynamic natives.
 * Instead of passing the format arg string, you can only pass the 
 *  actual format argument number itself.
 * If you pass 0, it will read the format string from an optional 
 *  fifth parameter.
 */
native vdformat(buffer[], len, fmt_arg, vararg, ...);
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-16-2009 , 14:41   Re: Native Text Formatting
Reply With Quote #6

Thanks. But I can't manage how to use vdformat() o_O.
__________________
hleV is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-16-2009 , 14:50   Re: Native Text Formatting
Reply With Quote #7

Something like I assume : vdformat( MyNewString, charsmax( MyNewString ), 3, szText );

3 because you the '...' is the third param.
__________________
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 06-16-2009 , 14:54   Re: Native Text Formatting
Reply With Quote #8

Quote:
Originally Posted by arkshine View Post
Something like I assume : vdformat( MyNewString, charsmax( MyNewString ), 3, szText );

3 because you the '...' is the third param.
It gives me an error on 4th vdformat()'s argument.
__________________
hleV is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 06-16-2009 , 15:46   Re: Native Text Formatting
Reply With Quote #9

Code:
AddMsg(Cl, Msg[], any:...);
Code:
fmt_arg = 2
vararg = 3
Code:
new message[128]
vdformat(message, charsmax( message ), 2, 3);
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-16-2009 , 15:48   Re: Native Text Formatting
Reply With Quote #10

Yeah, sorry. I was going to correct it. Thanks Emp`.
__________________
Arkshine 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 14:05.


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