Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions addons/sourcemod/scripting/shavit-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public void OnPluginStart()

gCV_Restart = new Convar("shavit_core_restart", "1", "Allow commands that restart the timer?", 0, true, 0.0, true, 1.0);
gCV_Pause = new Convar("shavit_core_pause", "1", "Allow pausing?", 0, true, 0.0, true, 1.0);
gCV_PauseMovement = new Convar("shavit_core_pause_movement", "0", "Allow movement/noclip while paused?", 0, true, 0.0, true, 1.0);
gCV_PauseMovement = new Convar("shavit_core_pause_movement", "0", "Allow movement/noclip while paused?\n0 - Disabled, no movement while paused.\n1 - Allow movement/noclip while paused, must stand still to pause.\n2 - Allow movement/noclip while paused, can pause while moving. (Not recommended)\n3 - Disallow movement/noclip while paused, can pause while moving.", 0, true, 0.0, true, 3.0);
gCV_BlockPreJump = new Convar("shavit_core_blockprejump", "0", "Prevents jumping in the start zone.", 0, true, 0.0, true, 1.0);
gCV_NoZAxisSpeed = new Convar("shavit_core_nozaxisspeed", "1", "Don't start timer if vertical speed exists (btimes style).", 0, true, 0.0, true, 1.0);
gCV_VelocityTeleport = new Convar("shavit_core_velocityteleport", "0", "Teleport the client when changing its velocity? (for special styles)", 0, true, 0.0, true, 1.0);
Expand Down Expand Up @@ -901,23 +901,30 @@ public Action Command_TogglePause(int client, int args)

Shavit_PrintToChat(client, "%T", "MessageUnpause", client, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
}
else if(gA_Timers[client].bClientPaused & (gCV_PauseMovement.IntValue == 2 || gCV_PauseMovement.IntValue == 3))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this be
else if(gA_Timers[client].bClientPaused && gCV_PauseMovement.IntValue >= 2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this be else if(gA_Timers[client].bClientPaused && gCV_PauseMovement.IntValue >= 2)

still same shit, i just wrote that way

{
TeleportEntity(client, gF_PauseOrigin[client], gF_PauseAngles[client], gF_PauseVelocity[client]);
ResumeTimer(client);

Shavit_PrintToChat(client, "%T", "MessageUnpause", client, gS_ChatStrings.sText, gS_ChatStrings.sVariable, gS_ChatStrings.sText);
}
else
{
if((iFlags & CPR_NotOnGround) > 0)
if((iFlags & CPR_NotOnGround) && (gCV_PauseMovement.IntValue == 0 || gCV_PauseMovement.IntValue == 1))
{
Shavit_PrintToChat(client, "%T", "PauseNotOnGround", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);

return Plugin_Handled;
}

if((iFlags & CPR_Moving) > 0)
if((iFlags & CPR_Moving) && (gCV_PauseMovement.IntValue == 0 || gCV_PauseMovement.IntValue == 1))
{
Shavit_PrintToChat(client, "%T", "PauseMoving", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);

return Plugin_Handled;
}

if((iFlags & CPR_Duck) > 0)
if((iFlags & CPR_Duck) && (gCV_PauseMovement.IntValue == 0 || gCV_PauseMovement.IntValue == 1))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that it seems completely necessary, but the > 0 could have been retained with your addition

i dont understand, it is just for 0 and 1 cuz you have to stand to pause

{
Shavit_PrintToChat(client, "%T", "PauseDuck", client, gS_ChatStrings.sWarning, gS_ChatStrings.sText);

Expand Down Expand Up @@ -2461,7 +2468,7 @@ public any Native_ShouldProcessFrame(Handle plugin, int numParams)

public Action Shavit_OnStartPre(int client, int track)
{
if (GetTimerStatus(client) == Timer_Paused && gCV_PauseMovement.BoolValue)
if (GetTimerStatus(client) == Timer_Paused && (gCV_PauseMovement.IntValue == 1 || gCV_PauseMovement.IntValue == 2 || gCV_PauseMovement.IntValue == 3))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe .BoolValue will return true as long as the value is > 0 so this can remain unchanged.. or you can just check .IntValue > 0 instead of specifying each individual case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe .BoolValue will return true as long as the value is > 0 so this can remain unchanged.. or you can just check .IntValue > 0 instead of specifying each individual case

not to keep that as bool but it will work

{
return Plugin_Stop;
}
Expand Down Expand Up @@ -3342,7 +3349,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3

int flags = GetEntityFlags(client);

if (gA_Timers[client].bClientPaused && IsPlayerAlive(client) && !gCV_PauseMovement.BoolValue)
if (gA_Timers[client].bClientPaused && IsPlayerAlive(client) && gCV_PauseMovement.IntValue == 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before on line 2471, this should be able to remain unchanged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as before on line 2471, this should be able to remain unchanged

not necessary but i dont want to keep it bool, just remember why i put 0 in here

{
buttons = 0;
vel = view_as<float>({0.0, 0.0, 0.0});
Expand All @@ -3354,6 +3361,17 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
return Plugin_Changed;
}

if (gA_Timers[client].bClientPaused && IsPlayerAlive(client) && gCV_PauseMovement.IntValue == 3)
{
buttons = 0;
TeleportEntity(client, gF_PauseOrigin[client], gF_PauseAngles[client], view_as<float>({0.0, 0.0, 0.0}));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i'm missing something.. but why teleport the client every tick if their movement is prevented? also this whole block can be removed and handled in line 3352 by checking if (gCV_PauseMovement.IntValue == 0 || gCV_PauseMovement.IntValue == 3) right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i'm missing something.. but why teleport the client every tick if their movement is prevented? also this whole block can be removed and handled in line 3352 by checking if (gCV_PauseMovement.IntValue == 0 || gCV_PauseMovement.IntValue == 3) right?

it doesnt work as you said, i have to teleport client to that position

SetEntityFlags(client, (flags | FL_ATCONTROLS));

//SetEntityMoveType(client, MOVETYPE_NONE);

return Plugin_Changed;
}

SetEntityFlags(client, (flags & ~FL_ATCONTROLS));

if (gI_HijackFrames[client])
Expand Down Expand Up @@ -3917,4 +3935,4 @@ void UpdateStyleSettings(int client)
{
UpdateAiraccelerate(client, GetStyleSettingFloat(gA_Timers[client].bsStyle, "airaccelerate"));
}
}
}