From 9a981491b00f51d2ce33f87fa215ce8cf1708c0c Mon Sep 17 00:00:00 2001 From: navewindre Date: Wed, 15 Nov 2023 05:47:20 +0100 Subject: fix going too fast while crouched --- sourcemod/scripting/bot2player_public.sp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'sourcemod/scripting/bot2player_public.sp') diff --git a/sourcemod/scripting/bot2player_public.sp b/sourcemod/scripting/bot2player_public.sp index 3dccd34..75793cc 100644 --- a/sourcemod/scripting/bot2player_public.sp +++ b/sourcemod/scripting/bot2player_public.sp @@ -21,6 +21,7 @@ new ClientTookover[MAXPLAYERS + 1] = {0, ...} new WrongTeamWarning[MAXPLAYERS + 1] = {0, ...} new TeleportWarning[MAXPLAYERS + 1] = {0, ...} new BotTakeverCost[MAXPLAYERS + 1] = {0, ...} +new NeedsDuck[MAXPLAYERS + 1] = {0, ...} new Nades[MAXPLAYERS + 1][3] new Float:Round_Restart_Delay = 0.0 @@ -166,7 +167,19 @@ public Action:Event_RoundFreezeEnd(Handle:Event, const String:name[], bool:dontB } public Action:OnPlayerRunCmd(iClient, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon) { - if (!IsClientConnected(iClient) || !(buttons & IN_USE) || IsPlayerAlive(iClient) || !b2pEnabled || !IsClientObserver(iClient)) return Plugin_Continue + if( !b2pEnabled ) + return Plugin_Continue; + + if( IsPlayerAlive(iClient) ) { + if( NeedsDuck[iClient] > 0 ) { + buttons |= IN_DUCK; + --NeedsDuck[iClient]; + } + + return Plugin_Continue; + } + + if (!IsClientConnected(iClient) || !(buttons & IN_USE) || !IsClientObserver(iClient)) return Plugin_Continue new iTarget = GetEntPropEnt(iClient, Prop_Send, "m_hObserverTarget") new ClientCash = GetMoney(iClient) if (IsValidClient(iTarget) && IsFakeClient(iTarget) && GetClientTeam(iClient) == GetClientTeam(iTarget) && ClientCash >= BotTakeverCost[iClient]) @@ -250,6 +263,12 @@ public Action:OnPlayerRunCmd(iClient, &buttons, &impulse, Float:vel[3], Float:an SetEntPropFloat(iClient, Prop_Send, "m_flDuckJumpTime", duckjumptime); SetEntProp(iClient, Prop_Send, "m_bInDuckJump", injumpduck, 1); + // duck for 10 ticks after respawn. fixes moving at full speed while ducked. + if( ducked || ducktime2 != 0 ) { + NeedsDuck[iClient] = 10; + buttons |= IN_DUCK + } + TeleportEntity(iClient, iTargetOrigin, iTargetAngles, NULL_VECTOR) SetConVarInt(NoEndRoundHandle, 0) PrintToChatAll("%N took control of %N", iClient, iTarget) -- cgit v1.2.3