From 253dec94d1770f427d679b795443141d9621976d Mon Sep 17 00:00:00 2001 From: Arkshine Date: Thu, 7 Apr 2016 20:27:27 +0200 Subject: [PATCH] Fix a crash after cs_set_user_model is used with model_index set. --- modules/cstrike/cstrike/CstrikeNatives.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index 47b3386c..9a1f9f8b 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -897,16 +897,16 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) GET_OFFSET("CBasePlayer", m_modelIndexPlayer); - char model[260]; - ke::SafeSprintf(model, sizeof(model), "models/player/%s/%s.mdl", newModel, newModel); + char modelpath[260]; + ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel); for (size_t i = 0; i < HL_MODEL_MAX; ++i) { - if (Server->model_precache[i] && !strcmp(Server->model_precache[i], model)) + if (Server->model_precache[i] && !strcmp(Server->model_precache[i], modelpath)) { if (pPlayer->v.modelindex != i) { - SET_MODEL(pPlayer, model); + SET_MODEL(pPlayer, STRING(ALLOC_STRING(modelpath))); } set_pdata(pPlayer, m_modelIndexPlayer, i);