From d3839db6f8dcd5f6e663d156a70b5effec30b187 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Sun, 14 Mar 2004 13:57:53 +0000 Subject: [PATCH] message_begin, message_end, write_* functions added back to core --- amxmodx/amxmod.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 6 deletions(-) diff --git a/amxmodx/amxmod.cpp b/amxmodx/amxmod.cpp index e946e5a5..57af98dd 100755 --- a/amxmodx/amxmod.cpp +++ b/amxmodx/amxmod.cpp @@ -1014,6 +1014,95 @@ static cell AMX_NATIVE_CALL set_cvar_string(AMX *amx, cell *params) /* 2 param * return 1; } +static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */ +{ + int numparam = *params/sizeof(cell); + Vector vecOrigin; + cell *cpOrigin; + switch (params[1]){ + case MSG_BROADCAST: + case MSG_ALL: + case MSG_SPEC: + MESSAGE_BEGIN( params[1], params[2],NULL ); + break; + case MSG_PVS: case MSG_PAS: + if (numparam < 3) { + amx_RaiseError(amx,AMX_ERR_NATIVE); + return 0; + } + cpOrigin = get_amxaddr(amx,params[3]); + vecOrigin.x = *cpOrigin; + vecOrigin.y = *(cpOrigin+1); + vecOrigin.z = *(cpOrigin+2); + MESSAGE_BEGIN( params[1], params[2] , vecOrigin ); + break; + case MSG_ONE: + if (numparam < 4) { + amx_RaiseError(amx,AMX_ERR_NATIVE); + return 0; + } + MESSAGE_BEGIN( MSG_ONE, params[2], NULL, INDEXENT(params[4]) ); + break; + } + + return 1; +} + +static cell AMX_NATIVE_CALL message_end(AMX *amx, cell *params) +{ + MESSAGE_END(); + return 1; +} + +static cell AMX_NATIVE_CALL write_byte(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_BYTE( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_char(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_CHAR( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_short(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_SHORT( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_long(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_LONG( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_entity(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_ENTITY( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_angle(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_ANGLE( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_coord(AMX *amx, cell *params) /* 1 param */ +{ + WRITE_COORD( params[1] ); + return 1; +} + +static cell AMX_NATIVE_CALL write_string(AMX *amx, cell *params) /* 1 param */ +{ + int a; + WRITE_STRING( get_amxstring(amx,params[1],3,a) ); + return 1; +} + static cell AMX_NATIVE_CALL log_message(AMX *amx, cell *params) /* 1 param */ { int len; @@ -2051,13 +2140,8 @@ static cell AMX_NATIVE_CALL log_amx(AMX *amx, cell *params) { CPluginMngr::CPlugin *plugin = g_plugins.findPluginFast(amx); int len; - // remove extension (.amx for example) - std::string name = plugin->getName(); - size_t pos = name.rfind('.'); - if (pos != std::string::npos) - name.erase(pos); - UTIL_Log("[%s] %s", name.c_str(), format_amxstring(amx, params, 1, len)); + UTIL_Log("[%s] %s", plugin->getName(), format_amxstring(amx, params, 1, len)); return 0; } @@ -2464,5 +2548,15 @@ AMX_NATIVE_INFO amxmod_Natives[] = { { "callfunc_push_float", callfunc_push_byval }, { "callfunc_push_intrf", callfunc_push_byref }, { "callfunc_push_floatrf", callfunc_push_byref }, + { "message_begin", message_begin }, + { "message_end", message_end }, + { "write_angle", write_angle }, + { "write_byte", write_byte }, + { "write_char", write_char }, + { "write_coord", write_coord }, + { "write_entity", write_entity }, + { "write_long", write_long }, + { "write_short", write_short }, + { "write_string", write_string }, { NULL, NULL } };