diff --git a/gamedata/common.games/entities.games/cstrike/offsets-chostage.txt b/gamedata/common.games/entities.games/cstrike/offsets-chostage.txt index b1d72bfa..f481ccf9 100644 --- a/gamedata/common.games/entities.games/cstrike/offsets-chostage.txt +++ b/gamedata/common.games/entities.games/cstrike/offsets-chostage.txt @@ -21,217 +21,217 @@ { "m_Activity" // int { - "windows" "424" + "windows" "384" "linux" "404" "mac" "404" } "m_bTouched" // BOOL { - "windows" "428" + "windows" "388" "linux" "408" "mac" "408" } "m_bRescueMe" // BOOL { - "windows" "432" + "windows" "392" "linux" "412" "mac" "412" } "m_flFlinchTime" // float { - "windows" "436" + "windows" "396" "linux" "416" "mac" "416" } "m_flNextChange" // float { - "windows" "440" + "windows" "400" "linux" "420" "mac" "420" } "m_flMarkPosition" // float { - "windows" "444" + "windows" "404" "linux" "424" "mac" "424" } "m_iModel" // int { - "windows" "448" + "windows" "408" "linux" "428" "mac" "428" } "m_iSkin" // int { - "windows" "452" + "windows" "412" "linux" "432" "mac" "432" } "m_flNextRadarTime" // float { - "windows" "456" + "windows" "416" "linux" "436" "mac" "436" } "m_State" // enum state { - "windows" "460" + "windows" "420" "linux" "440" "mac" "440" } "m_vStart" // Vector { - "windows" "464" + "windows" "424" "linux" "444" "mac" "444" } "m_vStartAngles" // Vector { - "windows" "476" + "windows" "436" "linux" "456" "mac" "456" } "m_vPathToFollow" // Vector[20] { - "windows" "488" + "windows" "448" "linux" "468" "mac" "468" } "m_iWaypoint" // int { - "windows" "728" + "windows" "688" "linux" "708" "mac" "708" } "m_target" // CBasePlayer* { - "windows" "732" + "windows" "692" "linux" "712" "mac" "712" } "m_LocalNav" // CLocalNav* { - "windows" "736" + "windows" "696" "linux" "716" "mac" "716" } "nTargetNode" // int { - "windows" "740" + "windows" "700" "linux" "720" "mac" "720" } "vecNodes" // Vector[100] { - "windows" "744" + "windows" "704" "linux" "724" "mac" "724" } "m_hStoppedTargetEnt" // EHANDLE { - "windows" "1944" + "windows" "1904" "linux" "1924" "mac" "1924" } "m_flNextFullThink" // float { - "windows" "1952" + "windows" "1912" "linux" "1932" "mac" "1932" } "m_flPathCheckInterval" // float { - "windows" "1956" + "windows" "1916" "linux" "1936" "mac" "1936" } "m_flLastPathCheck" // float { - "windows" "1960" + "windows" "1920" "linux" "1940" "mac" "1940" } "m_nPathNodes" // int { - "windows" "1964" + "windows" "1924" "linux" "1944" "mac" "1944" } "m_fHasPath" // BOOL { - "windows" "1968" + "windows" "1928" "linux" "1948" "mac" "1948" } "m_flPathAcquired" // float { - "windows" "1972" + "windows" "1932" "linux" "1952" "mac" "1952" } "m_vOldPos" // Vector { - "windows" "1976" + "windows" "1936" "linux" "1956" "mac" "1956" } "m_iHostageIndex" // int { - "windows" "1988" + "windows" "1948" "linux" "1968" "mac" "1968" } "m_bStuck" // BOOL { - "windows" "1992" + "windows" "1952" "linux" "1972" "mac" "1972" } "m_flStuckTime" // float { - "windows" "1996" + "windows" "1956" "linux" "1976" "mac" "1976" } "m_improv" // CHostageImprov* { - "windows" "2000" + "windows" "1960" "linux" "1980" "mac" "1980" } "m_whichModel" // enum ModelType { - "windows" "2004" + "windows" "1964" "linux" "1984" "mac" "1984" } diff --git a/modules/cstrike/cstrike/CstrikeDatas.h b/modules/cstrike/cstrike/CstrikeDatas.h index 753cecb2..8d9e1be6 100644 --- a/modules/cstrike/cstrike/CstrikeDatas.h +++ b/modules/cstrike/cstrike/CstrikeDatas.h @@ -47,7 +47,7 @@ #define CSI_SG552 CSW_SG552 #define CSI_AK47 CSW_AK47 #define CSI_P90 CSW_P90 -#define CSI_SHIELDGUN CSW_SHIELDGUN // The real CS value, use CSI_SHELD instead. +#define CSI_SHIELDGUN CSW_SHIELDGUN // The real CS value, use CSI_SHIELD instead. #define CSI_VEST CSW_VEST // Custom #define CSI_VESTHELM CSW_VESTHELM // Custom #define CSI_DEFUSER 33 // Custom diff --git a/modules/cstrike/cstrike/CstrikeHacks.cpp b/modules/cstrike/cstrike/CstrikeHacks.cpp index b654cf34..e5cf68f9 100644 --- a/modules/cstrike/cstrike/CstrikeHacks.cpp +++ b/modules/cstrike/cstrike/CstrikeHacks.cpp @@ -535,6 +535,11 @@ void InitGlobalVars() { Server = *reinterpret_cast(address); } + + if (!ServerStatic) + { + MF_Log("svs global variable is not available\n"); + } if (!Server) { diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index 3feb12f3..ea9205bf 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -473,7 +473,7 @@ static cell AMX_NATIVE_CALL cs_set_user_vip(AMX *amx, cell *params) } set_pdata(pPlayer, m_iModelName, modelName); - MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); + Players[index].ResetModel(pPlayer); } if (updateScoreboard) @@ -837,10 +837,11 @@ static cell AMX_NATIVE_CALL cs_set_user_nvg(AMX *amx, cell *params) if (nvg && get_pdata(pPlayer, m_bHasNightVision)) { UTIL_TextMsg_Generic(pPlayer, "#Already_Have_One"); - return 1; } - - set_pdata(pPlayer, m_bHasNightVision, nvg); + else + { + set_pdata(pPlayer, m_bHasNightVision, nvg); + } return 1; } @@ -887,7 +888,7 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) { if (!Server) { - MF_LogError(amx, AMX_ERR_NATIVE, "cs_set_user_model is disabled with update_index parameter set"); + MF_Log("cs_set_user_model is disabled with update_index parameter set"); return 0; } @@ -910,7 +911,7 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) } } - MF_LogError(amx, AMX_ERR_NATIVE, "Model must be precached"); + MF_Log("Model must be precached using cs_set_user_model with update_index parameter set"); return 0; } diff --git a/modules/cstrike/cstrike/CstrikePlayer.cpp b/modules/cstrike/cstrike/CstrikePlayer.cpp index a39a3343..05099bce 100644 --- a/modules/cstrike/cstrike/CstrikePlayer.cpp +++ b/modules/cstrike/cstrike/CstrikePlayer.cpp @@ -51,6 +51,18 @@ void StartFrame() if (ModelsUpdateQueue.empty()) { g_pFunctionTable->pfnStartFrame = nullptr; + + for (int i = 1; i < gpGlobals->maxClients; ++i) + { + if (Players[i].HasModel()) + { + RETURN_META(MRES_IGNORED); + } + } + + g_pFunctionTable->pfnClientUserInfoChanged = nullptr; + g_pengfuncsTable->pfnSetClientKeyValue = nullptr; + RETURN_META(MRES_IGNORED); } diff --git a/modules/cstrike/cstrike/CstrikePlayer.h b/modules/cstrike/cstrike/CstrikePlayer.h index 26a7af83..fa78644e 100644 --- a/modules/cstrike/cstrike/CstrikePlayer.h +++ b/modules/cstrike/cstrike/CstrikePlayer.h @@ -70,7 +70,7 @@ class CPlayer { MDLL_ClientUserInfoChanged(pPlayer, GETINFOKEYBUFFER(pPlayer)); - PostponeModeUpdate(ENTINDEX(pPlayer) - 1); + PostponeModelUpdate(ENTINDEX(pPlayer) - 1); } } @@ -89,7 +89,7 @@ class CPlayer SETCLIENTKEYVALUE(index, infobuffer, "model", m_Model); - PostponeModeUpdate(index - 1); + PostponeModelUpdate(index - 1); } } @@ -110,18 +110,24 @@ class CPlayer private: - void PostponeModeUpdate(int index) + void PostponeModelUpdate(int index) { - ServerStatic->clients[index].sendinfo = false; - - ModelsUpdateQueue.append(index); - if (!g_pFunctionTable->pfnStartFrame) { g_pFunctionTable->pfnStartFrame = StartFrame; g_pFunctionTable->pfnClientUserInfoChanged = ClientUserInfoChanged; g_pengfuncsTable->pfnSetClientKeyValue = SetClientKeyValue; } + + if (!ServerStatic) + { + MF_Log("Postponing of model update disabled, check your gamedata files"); + return; + } + + ServerStatic->clients[index].sendinfo = false; + + ModelsUpdateQueue.append(index); } private: diff --git a/modules/cstrike/cstrike/CstrikeUserMessages.cpp b/modules/cstrike/cstrike/CstrikeUserMessages.cpp index 9cb1cf87..00c368f6 100644 --- a/modules/cstrike/cstrike/CstrikeUserMessages.cpp +++ b/modules/cstrike/cstrike/CstrikeUserMessages.cpp @@ -41,7 +41,7 @@ UserMsg MessagesList[] = { { "ArmorType" , &MessageIdArmorType }, { "HLTV" , &MessageIdHLTV }, - { "CurWeapon" , &MessageIdMoney }, + { "Money" , &MessageIdMoney }, { "ResetHUD" , &MessageIdResetHUD }, { "ScoreAttrib", &MessageIdScoreAttrib }, { "ScoreInfo" , &MessageIdScoreInfo }, diff --git a/plugins/include/cstrike.inc b/plugins/include/cstrike.inc index cedc74f7..9961b81b 100755 --- a/plugins/include/cstrike.inc +++ b/plugins/include/cstrike.inc @@ -578,7 +578,7 @@ native cs_set_user_tked(index, tk = 1, subtract = 1); * @return 0 if the client is not driving, 1 if driving a vehicle but * not moving, 2 to 4 if driving positive speeds, 5 if * driving at a negative speed (backing), see TRAIN_* constants - * in hlsdk_cons.inc + * in hlsdk_const.inc * @error If the client index is not within the range of 1 to * MaxClients, or the client is not connected, an error will be * thrown. @@ -1045,7 +1045,7 @@ native Float:cs_get_hostage_nextuse(index); native cs_set_hostage_nextuse(index, Float:value); /** - * Returns the time the bomb will explode. + * Returns the game time at which the bomb will explode. * * @param index C4 entity * @@ -1056,7 +1056,7 @@ native cs_set_hostage_nextuse(index, Float:value); native Float:cs_get_c4_explode_time(index); /** - * Sets the time the bomb will explode. + * Sets the game time at which the bomb will explode. * * @param index C4 entity * @param value New explosion time