AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Native Text Formatting (https://forums.alliedmods.net/showthread.php?t=94834)

hleV 06-16-2009 05:22

Native Text Formatting
 
.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?

hzqst 06-16-2009 05:25

Re: Native Text Formatting
 
public _AddMsg(Cl, Msg[], any:...)

this : "_"

znovit 06-16-2009 06:33

Re: Native Text Formatting
 
as you probably can see he wants that underline;

Code:

register_native("AddMsg", "_AddMsg", 1);

xPaw 06-16-2009 06:44

Re: Native Text Formatting
 
Try this
PHP Code:

public _AddMsgiPluginiParams ) {
    new 
szText128 ];
    new 
Cl get_param);
    
get_string2szTextcharsmaxszText ) );
    
    
set_hudmessage(blabla);
    
show_hudmessage(ClszText);



Emp` 06-16-2009 13:36

Re: Native Text Formatting
 
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, ...);


hleV 06-16-2009 14:41

Re: Native Text Formatting
 
Thanks. But I can't manage how to use vdformat() o_O.

Arkshine 06-16-2009 14:50

Re: Native Text Formatting
 
Something like I assume : vdformat( MyNewString, charsmax( MyNewString ), 3, szText );

3 because you the '...' is the third param.

hleV 06-16-2009 14:54

Re: Native Text Formatting
 
Quote:

Originally Posted by arkshine (Post 850299)
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.

Emp` 06-16-2009 15:46

Re: Native Text Formatting
 
Code:

AddMsg(Cl, Msg[], any:...);
Code:

fmt_arg = 2
vararg = 3

Code:

new message[128]
vdformat(message, charsmax( message ), 2, 3);


Arkshine 06-16-2009 15:48

Re: Native Text Formatting
 
Yeah, sorry. I was going to correct it. Thanks Emp`.


All times are GMT -4. The time now is 14:05.

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