Added request am41585 (Orangutanz)

This commit is contained in:
Scott Ehlert 2006-07-19 04:23:00 +00:00
parent 49f46a5f4c
commit 1a6f4e08b2
3 changed files with 45 additions and 2 deletions

View File

@ -152,6 +152,16 @@ static cell AMX_NATIVE_CALL amx_glb(AMX *amx, cell *params)
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}
else if (paramnum == 3)
{
cell size = *(MF_GetAmxAddr(amx, params[4]));
if (Valtype == Ret_PChar)
{
cell *str = MF_GetAmxAddr(amx, params[2]);
return MF_SetAmxString(amx, params[3], STRING((int)*str), size);
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}
//if we got here, something happened
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown global index or return combination %d", iSwitch);

View File

@ -243,6 +243,8 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return rets.i;
} else if (ValType == Ret_Float) {
return (cell)rets.f;
} else if (ValType == Ret_String) {
return (cell)rets.s;
} else {
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
return 0;
@ -304,6 +306,20 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return MF_SetAmxString(amx, params[3], temp, size);
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
} else if (count == 3) {
cell size = *(MF_GetAmxAddr(amx, params[5]));
if (ValType == Ret_String)
{
const char *str = STRING(rets.s);
cell *addr = MF_GetAmxAddr(amx, params[3]);
*addr = (cell)rets.s;
if (!str)
str = "";
int num = MF_SetAmxString(amx, params[4], str, size);
return num;
}
MF_LogError(amx, AMX_ERR_NATIVE, "Invalid return type");
}

View File

@ -21,7 +21,16 @@
#pragma library fakemeta
#endif
/* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned. */
/* Returns entvar data from an entity Use the pev_* enum to specify which form of data you want returned.
*
* If retrieving strings, you may optionally get a pointer into the global string table. Depending on
* your situation, there are two ways to do this.
* 1: This simply gets the pointer.
* new ptr = pev(entid, pev_classname)
* 2: The pointer will be stored in ptr AND the actual string is retrieved.
* new ptr, classname[32]
* pev(entid, pev_classname, ptr, classname, 31)
*/
native pev(_index,_value,{Float,Sql,Result,_}:...);
/* Sets entvar data for an entity. Use the pev_* enum */
@ -32,7 +41,15 @@ native set_pev(_index,_value,{Float,Sql,Result,_}:...);
*/
native pev_valid(entindex);
/* Returns any global variable inside globalvars_t structure. Use the glb_* enum. */
/* Returns any global variable inside globalvars_t structure. Use the glb_* enum.
*
* When returning data from glb_pStringBase (the global string table), you may give a pointer into that table
* in order to get different strings.
* Example:
* new model[128]
* new ptr = pev(id, pev_viewmodel)
* global_get(glb_pStringBase, ptr, model, 127)
*/
native global_get(_value, {Float,Sql,Result,_}:...);
/* Returns an integer from private data. _linuxdiff is added into the _Offset if it's used on a linux server. */