From 44b4ff6f0573f6b64a3f4d7d55c28495da01aa65 Mon Sep 17 00:00:00 2001 From: Freeman-AM Date: Wed, 21 May 2014 00:59:48 +0200 Subject: [PATCH] Telemenu: Fix view_ofs not correctly set at teleportation --- plugins/telemenu.sma | 66 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/plugins/telemenu.sma b/plugins/telemenu.sma index 98f1ef71..8017c053 100755 --- a/plugins/telemenu.sma +++ b/plugins/telemenu.sma @@ -101,8 +101,37 @@ public actionTelMenu(id, key) if (g_menuOption[id] > 0) { - if (HasInDuckingStateSaved(id)) - set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + if ( HasInDuckingStateSaved(id) ) + { + new sz_modname[16] + + get_modname(sz_modname, charsmax(sz_modname)) + if (equal(sz_modname, "cstrike") // Counter-Strike 1.6 + || equal(sz_modname, "czero") // Counter-Strike: Condition Zero + || equal(sz_modname, "valve") // Half-Life + || equal(sz_modname, "tfc") // Team Fortress Classic + || equal(sz_modname, "gearbox")) // Half-Life: Opposing Force + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 12.0}) + } + else if (equal(sz_modname, "dod")) // Day of Defeat + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 18.0}) + } + else if (equal(sz_modname, "ns")) // Natural Selection + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + // Natural Selection handle view_ofs by itself + } + else if (equal(sz_modname, "ts")) // The Specialists + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 16.0}) + } + // Don't add this feature for mods that we don't know how their view_ofs work + } engfunc(EngFunc_SetOrigin, player, g_menuOrigin[id]) set_pev(player, pev_angles, g_menuVAngle[id]) set_pev(player, pev_fixangle, 1) @@ -111,8 +140,37 @@ public actionTelMenu(id, key) pev(id, pev_origin, f_origin) pev(id, pev_v_angle, f_vangle) - if (HasInDuckingStateSaved(id)) - set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + if ( HasInDuckingStateSaved(id) ) + { + new sz_modname[16] + + get_modname(sz_modname, charsmax(sz_modname)) + if (equal(sz_modname, "cstrike") // Counter-Strike 1.6 + || equal(sz_modname, "czero") // Counter-Strike: Condition Zero + || equal(sz_modname, "valve") // Half-Life + || equal(sz_modname, "tfc") // Team Fortress Classic + || equal(sz_modname, "gearbox")) // Half-Life: Opposing Force + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 12.0}) + } + else if (equal(sz_modname, "dod")) // Day of Defeat + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 18.0}) + } + else if (equal(sz_modname, "ns")) // Natural Selection + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + // Natural Selection handle view_ofs by itself + } + else if (equal(sz_modname, "ts")) // The Specialists + { + set_pev(player, pev_flags, pev(player, pev_flags) | FL_DUCKING) + set_pev(id, pev_view_ofs, {0.0, 0.0, 16.0}) + } + // Don't add this feature for mods that we don't know how their view_ofs work + } engfunc(EngFunc_SetOrigin, player, f_origin) set_pev(player, pev_angles, f_vangle) set_pev(player, pev_fixangle, 1)