[Include] H_Format - Format option in functions
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
Could I suggest you look up y_va? That allows you to do this much simpler, while allowing the full range of format options, things like "%02d", which is valid and not supported by your code:

pawn Код:
#include <YSI\y_va>

stock SendClientMessageEx(playerid, color, format[], va_args<>)
{
    // Format destination.
    new
        str[145];
    // 3 for "playerid, color, format"
    va_format(str, sizeof (str), format, va_start<3>);
    // Send the message.
    return SendClientMessage(playerid, color, str);
}
I've also changed the "f" to "Ex" - that's a minor change and you could have used "F" instead of "Ex", but "SendClientMessage" is a camel-case function, and appending "f" to the end looks like part of the previous word, not a new word.

Alternatively, if you do want to implement the whole of the format function from scratch then look up "AMXModX", their "format" function is based on the Quake one, and also happens to be the function that the SA:MP "format" function is based on so you can see how things like widths and precisions are implemented.
yea right, the only different thing is, his works and yours doesn't work.
Well I maybe works but only if you have a clean gamemode. As soon you are going to script your own lines into it, suddenly everyhing seems to get fucked. I like other includes of you. But this one fails.
Reply


Messages In This Thread
H_Format - Format option in functions - by [LoD]Hauke - 01.10.2012, 21:10
Re: H_Format - Format option in functions - by Sniper Kitty - 02.10.2012, 02:44
Re: H_Format - Format option in functions - by Ballu Miaa - 02.10.2012, 15:58
Re: H_Format - Format option in functions - by Roel - 03.10.2012, 18:46
Re: H_Format - Format option in functions - by Sniper Kitty - 03.10.2012, 18:52
Re: H_Format - Format option in functions - by Roel - 03.10.2012, 19:07

Forum Jump:


Users browsing this thread: 1 Guest(s)