summaryrefslogtreecommitdiff
path: root/sourcemod/scripting/bot2player_public.sp
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 /sourcemod/scripting/bot2player_public.sp
parentb0b6f32c17f5efa5b35926430e721735371c3bce (diff)
fix going too fast while crouched
Diffstat (limited to 'sourcemod/scripting/bot2player_public.sp')
-rw-r--r--sourcemod/scripting/bot2player_public.sp21
1 files changed, 20 insertions, 1 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)