mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-24 13:55:36 +03:00
added server_changelevel back
fixed bug where NULL FP_STRING could crash forwards
This commit is contained in:
parent
e0d4ad0a06
commit
f0f8b78df9
@ -88,9 +88,12 @@ cell CForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||
{
|
||||
if (m_ParamTypes[i] == FP_STRING || m_ParamTypes[i] == FP_STRINGEX)
|
||||
{
|
||||
const char *str = reinterpret_cast<const char*>(params[i]);
|
||||
cell *tmp;
|
||||
amx_Allot(iter->pPlugin->getAMX(), (m_ParamTypes[i] == FP_STRING) ? strlen(reinterpret_cast<const char*>(params[i])) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
|
||||
amx_SetStringOld(tmp, (const char *)(params[i]), 0, 0);
|
||||
if (!str)
|
||||
str = "";
|
||||
amx_Allot(iter->pPlugin->getAMX(), (m_ParamTypes[i] == FP_STRING) ? strlen(str) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
|
||||
amx_SetStringOld(tmp, str, 0, 0);
|
||||
physAddrs[i] = tmp;
|
||||
}
|
||||
else if (m_ParamTypes[i] == FP_ARRAY)
|
||||
@ -248,9 +251,12 @@ cell CSPForward::execute(cell *params, ForwardPreparedArray *preparedArrays)
|
||||
{
|
||||
if (m_ParamTypes[i] == FP_STRING || m_ParamTypes[i] == FP_STRINGEX)
|
||||
{
|
||||
const char *str = reinterpret_cast<const char*>(params[i]);
|
||||
if (!str)
|
||||
str = "";
|
||||
cell *tmp;
|
||||
amx_Allot(m_Amx, (m_ParamTypes[i] == FP_STRING) ? strlen(reinterpret_cast<const char*>(params[i])) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
|
||||
amx_SetStringOld(tmp, (const char *)(params[i]), 0, 0);
|
||||
amx_Allot(m_Amx, (m_ParamTypes[i] == FP_STRING) ? strlen(str) + 1 : STRINGEX_MAXLENGTH, &realParams[i], &tmp);
|
||||
amx_SetStringOld(tmp, str, 0, 0);
|
||||
physAddrs[i] = tmp;
|
||||
}
|
||||
else if (m_ParamTypes[i] == FP_ARRAY)
|
||||
|
@ -307,6 +307,7 @@ extern int FF_PluginLog;
|
||||
extern int FF_PluginEnd;
|
||||
extern int FF_InconsistentFile;
|
||||
extern int FF_ClientAuthorized;
|
||||
extern int FF_ChangeLevel;
|
||||
extern bool g_coloredmenus;
|
||||
extern int g_mm_vers;
|
||||
|
||||
|
@ -148,6 +148,7 @@ int FF_PluginLog = -1;
|
||||
int FF_PluginEnd = -1;
|
||||
int FF_InconsistentFile = -1;
|
||||
int FF_ClientAuthorized = -1;
|
||||
int FF_ChangeLevel = -1;
|
||||
|
||||
// Precache stuff from force consistency calls
|
||||
// or check for pointed files won't be done
|
||||
@ -316,6 +317,7 @@ int C_Spawn(edict_t *pent)
|
||||
FF_PluginEnd = registerForward("plugin_end", ET_IGNORE, FP_DONE);
|
||||
FF_InconsistentFile = registerForward("inconsistent_file", ET_STOP, FP_CELL, FP_STRING, FP_STRINGEX, FP_DONE);
|
||||
FF_ClientAuthorized = registerForward("client_authorized", ET_IGNORE, FP_CELL, FP_DONE);
|
||||
FF_ChangeLevel = registerForward("server_changelevel", ET_STOP, FP_STRING, FP_DONE);
|
||||
|
||||
modules_callPluginsLoaded();
|
||||
|
||||
@ -1070,6 +1072,14 @@ void C_AlertMessage_Post(ALERT_TYPE atype, char *szFmt, ...)
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_ChangeLevel(char *map, char *what)
|
||||
{
|
||||
int ret = executeForwards(FF_ChangeLevel, map);
|
||||
if (ret)
|
||||
RETURN_META(MRES_SUPERCEDE);
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
void C_CvarValue2(const edict_t *pEdict, int requestId, const char *cvar, const char *value)
|
||||
{
|
||||
CPlayer *pPlayer = GET_PLAYER_POINTER(pEdict);
|
||||
@ -1426,6 +1436,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte
|
||||
meta_engfuncs.pfnCmd_Args = C_Cmd_Args;
|
||||
meta_engfuncs.pfnPrecacheModel = C_PrecacheModel;
|
||||
meta_engfuncs.pfnPrecacheSound = C_PrecacheSound;
|
||||
meta_engfuncs.pfnChangeLevel = C_ChangeLevel;
|
||||
|
||||
memcpy(pengfuncsFromEngine, &meta_engfuncs, sizeof(enginefuncs_t));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user