Added get_string() to engine:

/* Converts a string offset into a real string. Some of the forwards in fakemeta
   uses string offsets. (FM_CreateNamedEntity) */
native get_string(_string, _returnString[], _len);
This commit is contained in:
Johnny Bergström 2004-09-16 11:02:51 +00:00
parent 1980c524d3
commit d43807a248
2 changed files with 17 additions and 0 deletions

View File

@ -8,6 +8,10 @@ int g_CameraCount;
TraceResult g_tr; TraceResult g_tr;
#define BUFFERSIZE 1023
char g_buffer[BUFFERSIZE + 1];
void UTIL_SetSize(edict_t *pev, const Vector &vecMin, const Vector &vecMax) void UTIL_SetSize(edict_t *pev, const Vector &vecMin, const Vector &vecMax)
{ {
SET_SIZE(ENT(pev), vecMin, vecMax); SET_SIZE(ENT(pev), vecMin, vecMax);
@ -898,6 +902,13 @@ static cell AMX_NATIVE_CALL traceresult(AMX *amx, cell *params)
return 0; return 0;
} }
// (jghg)
static cell AMX_NATIVE_CALL get_string(AMX *amx, cell *params) // (string, returnstring[], length)
{
snprintf(g_buffer, BUFFERSIZE, "%s", STRING(params[1]));
return MF_SetAmxString(amx, params[2], g_buffer, params[3]);
}
AMX_NATIVE_INFO engine_Natives[] = { AMX_NATIVE_INFO engine_Natives[] = {
{"halflife_time", halflife_time}, {"halflife_time", halflife_time},
@ -938,6 +949,8 @@ AMX_NATIVE_INFO engine_Natives[] = {
{"register_think", register_think}, {"register_think", register_think},
{"register_touch", register_touch}, {"register_touch", register_touch},
{"get_string", get_string},
{NULL, NULL}, {NULL, NULL},
/////////////////// ///////////////////
}; };

View File

@ -222,6 +222,10 @@ native get_usercmd(type,{Float,Sql,Result,_}:...);
Note that your changes will be seen by any other plugin doing get_usercmd() */ Note that your changes will be seen by any other plugin doing get_usercmd() */
native set_usercmd(type,{Float,Sql,Result,_}:...); native set_usercmd(type,{Float,Sql,Result,_}:...);
/* Converts a string offset into a real string. Some of the forwards in fakemeta
uses string offsets. (FM_CreateNamedEntity) */
native get_string(_string, _returnString[], _len);
/* FORWARDS /* FORWARDS
**********/ **********/