Fix broken cs_set_user_model update_index parameter for the default engine (#450)
This commit is contained in:
parent
4fcfc913d3
commit
304e992942
|
@ -37,30 +37,6 @@ int AmxxCheckGame(const char *game)
|
|||
return AMXX_GAME_BAD;
|
||||
}
|
||||
|
||||
void SV_ActivateServer_RH(IRehldsHook_SV_ActivateServer *chain, int runPhysics)
|
||||
{
|
||||
chain->callNext(runPhysics);
|
||||
|
||||
auto numResources = RehldsData->GetResourcesNum();
|
||||
|
||||
if (!numResources)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModelsList.clear();
|
||||
|
||||
for (auto i = 0; i < numResources; ++i) // Saves all the precached models into a list.
|
||||
{
|
||||
auto resource = RehldsData->GetResource(i);
|
||||
|
||||
if (resource->type == t_model)
|
||||
{
|
||||
ModelsList.insert(resource->szFileName, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnAmxxAttach()
|
||||
{
|
||||
MF_AddNatives(CstrikeNatives);
|
||||
|
@ -85,11 +61,6 @@ void OnAmxxAttach()
|
|||
}
|
||||
|
||||
InitializeHacks();
|
||||
|
||||
if (HasReHlds)
|
||||
{
|
||||
RehldsHookchains->SV_ActivateServer()->registerHook(SV_ActivateServer_RH);
|
||||
}
|
||||
}
|
||||
|
||||
void OnPluginsLoaded()
|
||||
|
@ -131,6 +102,8 @@ void OnServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
|
|||
ToggleHook_BuyCommands(HasOnBuyForward);
|
||||
ToggleHook_GiveDefaultItems(false);
|
||||
|
||||
ModelsList.clear();
|
||||
|
||||
RETURN_META(MRES_IGNORED);
|
||||
}
|
||||
|
||||
|
|
|
@ -856,12 +856,30 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params)
|
|||
|
||||
if (*params / sizeof(cell) >= 3 && params[3] != 0)
|
||||
{
|
||||
if (!Server)
|
||||
if (!HasReHlds && !Server)
|
||||
{
|
||||
MF_Log("cs_set_user_model is disabled with update_index parameter set");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ModelsList.elements())
|
||||
{
|
||||
auto numResources = HasReHlds ? RehldsData->GetResourcesNum() : Server->num_resources;
|
||||
|
||||
if (numResources)
|
||||
{
|
||||
for (auto i = 0; i < numResources; ++i) // Saves all the precached models into a list.
|
||||
{
|
||||
auto resource = HasReHlds ? RehldsData->GetResource(i) : &Server->resourcelist[i];
|
||||
|
||||
if (resource->type == t_model)
|
||||
{
|
||||
ModelsList.insert(resource->szFileName, resource->nIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GET_OFFSET("CBasePlayer", m_modelIndexPlayer);
|
||||
|
||||
char modelpath[260];
|
||||
|
|
Loading…
Reference in New Issue
Block a user