summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-11-15 05:47:20 +0100
committernavewindre <nw@moneybot.cc>2023-11-15 05:47:20 +0100
commit9a981491b00f51d2ce33f87fa215ce8cf1708c0c (patch)
treeca829c09e80911edbb4cad5117bc84f233d6b8f9
parentb0b6f32c17f5efa5b35926430e721735371c3bce (diff)
fix going too fast while crouched
-rw-r--r--sourcemod/scripting/bot2player_public.sp21
-rw-r--r--sourcemod/scripting/sm_speedometer.sp6
2 files changed, 24 insertions, 3 deletions
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)
diff --git a/sourcemod/scripting/sm_speedometer.sp b/sourcemod/scripting/sm_speedometer.sp
index 625395b..80d564f 100644
--- a/sourcemod/scripting/sm_speedometer.sp
+++ b/sourcemod/scripting/sm_speedometer.sp
@@ -235,10 +235,12 @@ public Action:Event_OnRoundEnd(Handle:event, const String:name[], bool:dontBroad
{
if(g_hTimer_Display[i] != INVALID_HANDLE && CloseHandle(g_hTimer_Display[i]))
g_hTimer_Display[i] = INVALID_HANDLE;
- }
+ }
if( g_bShowDisplay[i] && g_iDisplayMethod == 1 && IsPlayerAlive(i) && !IsFakeClient(i) ) {
- if( winner == 1 )
+ if( reason == 15 )
+ PrintHintText( i, "Game commencing" );
+ else if( winner == 1 )
PrintHintText( i, "Round Draw" );
else if( winner == 2 )
PrintHintText( i, "Terrorists Win" );