Raised This Month: $51 Target: $400
 12% 

cs_set_user_model [#417]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 07-26-2017 , 20:38   cs_set_user_model [#417]
Reply With Quote #1

I think Add basic ReHLDS and ReGameDLL support #417 broke cs_set_user_model's update_index.

Code:
#include <amxmodx> #include <cstrike> #include <hamsandwich> public plugin_precache() {     precache_model("models/player/vip/vip.mdl"); } public plugin_init() {     RegisterHam(Ham_Spawn, "player", "OnSpawnPost",  .Post = true); } public OnSpawnPost(id) {     if(is_user_alive(id))     {         cs_set_user_model(id, "vip", true);     } }

Is that the correct usage? It prints:
Code:
[CSTRIKE] Model must be precached using cs_set_user_model with update_index parameter set
CstrikeNatives.cpp
Code:
    if (*params / sizeof(cell) >= 3 && params[3] != 0)     {         if (!Server)         {             MF_Log("cs_set_user_model is disabled with update_index parameter set");             return 0;         }         GET_OFFSET("CBasePlayer", m_modelIndexPlayer);         char modelpath[260];         ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel);         auto modelIndex = 0;         if (ModelsList.retrieve(modelpath, &modelIndex))         {             if (pPlayer->v.modelindex != modelIndex)             {                 SET_MODEL(pPlayer, STRING(ALLOC_STRING(modelpath)));             }             set_pdata<int>(pPlayer, m_modelIndexPlayer, modelIndex);             return 1;         }         MF_Log("Model must be precached using cs_set_user_model with update_index parameter set");         return 0;     }


CstrikeMain.cpp
Code:
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);         }     } }

SV_ActivateServer_RH is only called on ReHLDS:
Code:
void OnAmxxAttach() { . . . .     if (HasReHlds)     {         RehldsHookchains->SV_ActivateServer()->registerHook(SV_ActivateServer_RH);     } }
PartialCloning is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-27-2017 , 03:26   Re: cs_set_user_model [#417]
Reply With Quote #2

Looks like I forgot to reintroduce the original code for the default engine.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode