mirror of
https://github.com/dashr9230/SA-MP.git
synced 2026-10-10 03:33:04 +08:00
[bot] Implement n_format(...)
* Implement `format_amxstring(...)` * Implement `get_amxaddr(...)` * Implement `AddString(...)` * Implement `AddFloat(...)` * Implement `AddInt(...)` * Implement `AddHex(...)` * Implement `AddBin(...)` * Implement `__WHOA_DONT_CALL_ME_PLZ_K_lol_o_O()` * Implement `atcprintf(...)`
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
|
||||
#include "main.h"
|
||||
#include <ctype.h>
|
||||
#include "format.h"
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
@@ -143,6 +145,13 @@ void AMXPrintError(CGameMode* pGameMode, AMX *amx, int error)
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
cell* get_amxaddr(AMX *amx,cell amx_addr)
|
||||
{
|
||||
return (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max)
|
||||
{
|
||||
cell* dest = (cell *)(amx->base + (int)(((AMX_HEADER *)amx->base)->dat + amx_addr));
|
||||
@@ -155,3 +164,12 @@ int set_amxstring(AMX *amx,cell amx_addr,const char *source,int max)
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
char* format_amxstring(AMX *amx, cell *params, int parm, int &len)
|
||||
{
|
||||
static char outbuf[4096];
|
||||
cell *addr = get_amxaddr(amx, params[parm++]);
|
||||
len = atcprintf(outbuf, sizeof(outbuf)-1, addr, amx, params, &parm);
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user