Implemented request amb237 - added ServerPrint to Fakemeta

This commit is contained in:
Scott Ehlert 2007-04-30 18:29:33 +00:00
parent fd8489d088
commit 897ed0cb10
6 changed files with 23 additions and 4 deletions

View File

@ -1072,6 +1072,11 @@ static cell AMX_NATIVE_CALL engfunc(AMX *amx, cell *params)
(*g_engfuncs.pfnClientPrintf)(INDEXENT2(index), static_cast<PRINT_TYPE>(iparam1), temp);
return 1;
case EngFunc_ServerPrint: // void ) (const char *szMsg);
temp = MF_GetAmxString(amx, params[2], 0, &len);
(*g_engfuncs.pfnServerPrint)(temp);
return 1;
default:
MF_LogError(amx, AMX_ERR_NATIVE, "Unknown engfunc type %d", type);
return 0;

View File

@ -81,7 +81,8 @@ enum {
EngFunc_CreateInstancedBaseline, // int ) (int classname, struct entity_state_s *baseline);
EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e);
EngFunc_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...);
EngFunc_ClientPrintf // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ServerPrint // void ) (const char *szMsg);
};
#endif //_ENGFUNC_INCLUDE_H

View File

@ -652,6 +652,8 @@ void ClientPrintf_post(edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg)
RETURN_META(MRES_IGNORED);
}
SIMPLE_VOID_HOOK_CONSTSTRING(ServerPrint);
/*
* Beginning of Engine->Game DLL hooks
*/
@ -1481,6 +1483,10 @@ static cell AMX_NATIVE_CALL register_forward(AMX *amx, cell *params)
fId = MF_RegisterSPForwardByName(amx, funcname, FP_CELL, FP_CELL, FP_STRING, FP_DONE);
ENGHOOK(ClientPrintf);
break;
case FM_ServerPrint:
fId = MF_RegisterSPForwardByName(amx, funcname, FP_STRING, FP_DONE);
ENGHOOK(ServerPrint);
break;
#if 0
// I know this does not fit with DLLFUNC(), but I dont want another native just for it.

View File

@ -164,6 +164,7 @@ enum {
FM_CreateBaseline,
FM_GetInfoKeyBuffer,
FM_ClientPrintf,
FM_ServerPrint,
FM_LAST_DONT_USE_ME
};

View File

@ -119,7 +119,8 @@ enum {
// Returns pointer to info buffer that can be used with the infobuffer param of InfoKeyValue, SetKeyValue, and SetClientKeyValue
EngFunc_GetInfoKeyBuffer, // char*) (edict_t *e);
EngFunc_AlertMessage, // void ) (ALERT_TYPE atype, char *szFmt, ...);
EngFunc_ClientPrintf // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ClientPrintf, // void ) (edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg);
EngFunc_ServerPrint // void ) (const char *szMsg);
};
/* Used with dllfunc()
@ -540,7 +541,10 @@ enum {
FM_CreateInstBaseline,
FM_CreateBaseline,
FM_GetInfoKeyBuffer,
FM_ClientPrintf
FM_ClientPrintf,
// LATE ADDITIONS (v1.80)
FM_ServerPrint
};
enum TraceResult

View File

@ -193,6 +193,8 @@ stock EF_GetInfoKeyBuffer(const ENTITY)
return engfunc(EngFunc_GetInfoKeyBuffer, ENTITY);
stock EF_ClientPrintf(const ENTITY, const printType, const MESSAGE[])
return engfunc(EngFunc_ClientPrintf, ENTITY, printType, MESSAGE);
stock EF_ServerPrint(const MESSAGE[])
return engfunc(EngFunc_ServerPrint, MESSAGE);
// DLLFuncs
stock DF_GameInit()