From c6e8a356ee16e805abd947156ab8ae8e7b9823d5 Mon Sep 17 00:00:00 2001 From: Scott Ehlert Date: Wed, 10 May 2006 11:28:00 +0000 Subject: [PATCH] Added request at29487 1) New hookable Engine func: GetInfoKeyBuffer 2) New GameDLL func that can be called via engfunc: GetInfoKeyBuffer 3) New native: copy_infokey_buffer that copies data out of the specified info key buffer 4) EngFunc_InfoKeyValue, EngFunc_SetKeyValue, and EngFunc_SetClientKeyValue have been reworked so that they expect pointers to an info key buffer in order to work properly o_O --- plugins/include/fakemeta.inc | 13 +++++-------- plugins/include/fakemeta_const.inc | 12 +++++++++--- plugins/include/fakemeta_stocks.inc | 14 ++++++++------ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index a482a11c..b694f980 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -9,14 +9,7 @@ #include -#if AMXX_VERSION_NUM >= 175 - #pragma reqlib fakemeta - #if !defined AMXMODX_NOAUTOLOAD - #pragma loadlib fakemeta - #endif -#else - #pragma library fakemeta -#endif +#pragma library fakemeta /* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned. */ native pev(_index,_value,{Float,Sql,Result,_}:...); @@ -124,3 +117,7 @@ native get_pdata_string(entity, offset, dest[], maxlength, byref=1, linux=-5); //realloc = 1 - reallocate new string with free+malloc //realloc = 2 - reallocate new string with delete[]+new[] native set_pdata_string(entity, offset, const source[], realloc=2, linux=-5); + +// Copies the given infoBuffer pointer into out[] +// An infoBuffer pointer is returned by EngFunc_GetInfoKeyBuffer +native copy_infokey_buffer(infoBuffer, out[], maxlen); diff --git a/plugins/include/fakemeta_const.inc b/plugins/include/fakemeta_const.inc index 8e7cf021..43720886 100755 --- a/plugins/include/fakemeta_const.inc +++ b/plugins/include/fakemeta_const.inc @@ -20,6 +20,9 @@ #define FMRES_IGNORED 1 #define FMRES_OVERRIDE 3 +// Use this with GetInfoKeyBuffer if you want the server's localinfo buffer +#define FM_NULLENT -1 + /* Used with engfunc() */ @@ -105,7 +108,8 @@ enum { EngFunc_InfoKeyValue, // char*) (char *infobuffer, char *key); EngFunc_SetKeyValue, // void ) (char *infobuffer, char *key, char *value); EngFunc_SetClientKeyValue, // void ) (int clientIndex, char *infobuffer, char *key, char *value); - EngFunc_CreateInstBaseline // int ) (int classname, struct entity_state_s *baseline); + EngFunc_CreateInstBaseline, // int ) (int classname, struct entity_state_s *baseline); + EngFunc_GetInfoKeyBuffer // char*) (edict_t *e); }; /* Used with dllfunc() @@ -513,14 +517,16 @@ enum { FM_ShouldCollide, //LATE ADDITIONS (v1.71) - FM_ClientUserInfoChanged, //passes id only + FM_ClientUserInfoChanged, + // LATE ADDITIONS (v1.75) FM_UpdateClientData, FM_AddToFullPack, FM_CmdStart, FM_CmdEnd, FM_CreateInstBaseline, - FM_CreateBaseline + FM_CreateBaseline, + FM_GetInfoKeyBuffer }; enum TraceResult diff --git a/plugins/include/fakemeta_stocks.inc b/plugins/include/fakemeta_stocks.inc index e63760c9..0371e522 100755 --- a/plugins/include/fakemeta_stocks.inc +++ b/plugins/include/fakemeta_stocks.inc @@ -175,16 +175,18 @@ stock EF_WriteCoord(Float:value) return engfunc(EngFunc_WriteCoord, value) stock EF_WriteAngle(Float:value) return engfunc(EngFunc_WriteAngle, value) -stock EF_InfoKeyValue(const CLIENT, const KEY[], returnValue[], maxLength) - return engfunc(EngFunc_InfoKeyValue, CLIENT, KEY, returnValue, maxLength) -stock EF_SetKeyValue(const BUFFER[], const KEY[], const VALUE[]) - return engfunc(EngFunc_SetKeyValue, BUFFER, KEY, VALUE) +stock EF_InfoKeyValue(const INFOBUFFER, const KEY[], returnValue[], maxLength) + return engfunc(EngFunc_InfoKeyValue, INFOBUFFER, KEY, returnValue, maxLength) +stock EF_SetKeyValue(const INFOBUFFER, const KEY[], const VALUE[]) + return engfunc(EngFunc_SetKeyValue, INFOBUFFER, KEY, VALUE) -stock EF_SetClientKeyValue(const ID, const KEY[], const VALUE[]) - return engfunc(EngFunc_SetClientKeyValue, ID, KEY, VALUE) +stock EF_SetClientKeyValue(const ID, const INFOBUFFER, const KEY[], const VALUE[]) + return engfunc(EngFunc_SetClientKeyValue, ID, INFOBUFFER, KEY, VALUE) stock EF_CreateInstBaseline(CLASSNAME, baseline) return engfunc(EngFunc_CreateInstBaseline, CLASSNAME, baseline) +stock EF_GetInfoKeyBuffer(const ENTITY) + return engfunc(EngFunc_GetInfoKeyBuffer, ENTITY) // DLLFuncs stock DF_GameInit()