message_begin now reports an error instead of letting th server abort when the id is invalid

This commit is contained in:
Pavol Marko 2004-11-04 21:54:46 +00:00
parent 850557df5a
commit 50a882cf4c

View File

@ -1205,6 +1205,14 @@ static cell AMX_NATIVE_CALL message_begin(AMX *amx, cell *params) /* 4 param */
int numparam = *params/sizeof(cell); int numparam = *params/sizeof(cell);
float vecOrigin[3]; float vecOrigin[3];
cell *cpOrigin; cell *cpOrigin;
if (params[2] < 1 || ((params[2] > 63) // maximal number of engine messages
&& !GET_USER_MSG_NAME(PLID, params[2], NULL)))
{
AMXXLOG_Log("[AMXX] Plugin called message_begin with an invalid message id (%d).", params[2]);
amx_RaiseError(amx, AMX_ERR_NATIVE);
return 0;
}
switch (params[1]){ switch (params[1]){
case MSG_BROADCAST: case MSG_BROADCAST:
case MSG_ALL: case MSG_ALL: