[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:
RD42
2024-06-25 22:37:19 +08:00
parent 5467762720
commit 9de4780943
5 changed files with 498 additions and 2 deletions
+18
View File
@@ -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;
}
//----------------------------------------------------------------------------------