fmt.inc
Get size of arguments (count of arguments multiply by sizeof(cell))
VIP Сървъри
Всички сървъри
#if defined _fmt_included
#endinput
#endif
#define _fmt_included
#if !defined MAX_FMT_LENGTH
const MAX_FMT_LENGTH = 256
#if !defined __vformat_allower
#define __vformat_allower __vformat_allower_
__vformat_allower_()
{
vformat("", 0, "", 0)
}
#endif
stock fmt(const format[], any:...)
{
static formatted[MAX_FMT_LENGTH]
#emit PUSH.C 0x2
#emit PUSH.S format
const FORMATTED_CHARSMAX = charsmax(formatted)
#emit PUSH.C FORMATTED_CHARSMAX
#emit LOAD.S.PRI 0x8 // Get size of arguments (count of arguments multiply by sizeof(cell))
#emit ADDR.ALT 0xC // This is the pointer to first argument
#emit ADD // Now in PRI we have the pointer to hidden return argument
#emit LOAD.I // Now in PRI we have the pointer to return buffer
#emit PUSH.PRI
#emit PUSH.C 0x10
#emit SYSREQ.C vformat
#emit STACK 0x14
#emit RETN // Don't execute the code for copy return generated by compiler
__vformat_allower()
return formatted
}
#endif
КАК ДА ИЗПОЛЗВАМ
Добави в началото на .sma файла:
#include <fmt>
1. Изтегли
Свали файла от бутона по-горе
2. Копирай
Постави в
scripting/include/3. Включи
Добави #include директивата
4. Компилирай
Използвай amxxpc или scripting/compile.exe