|
33 | 33 | public Plugin myinfo = |
34 | 34 | { |
35 | 35 | name = "Pause plugin", |
36 | | - author = "CanadaRox, Sir, Forgetest", |
| 36 | + author = "CanadaRox, Sir, Forgetest, A1m`", |
37 | 37 | description = "Adds pause functionality without breaking pauses, also prevents SI from spawning because of the Pause.", |
38 | | - version = "6.7.1", |
| 38 | + version = "6.8", |
39 | 39 | url = "https://github.com/SirPlease/L4D2-Competitive-Rework" |
40 | 40 | }; |
41 | 41 |
|
@@ -178,6 +178,7 @@ public void OnClientPutInServer(int client) |
178 | 178 | if (!IsFakeClient(client)) |
179 | 179 | { |
180 | 180 | CPrintToChatAll("%t %t", "Tag", "ClientFullyLoaded", client); |
| 181 | + SetEntPropFloat(client, Prop_Data, "m_fLastPlayerTalkTime", 0.0); |
181 | 182 | } |
182 | 183 | } |
183 | 184 | } |
@@ -501,15 +502,17 @@ void Pause() |
501 | 502 | CPrintToChat(client, "%t %t", "Tag", "PausePreventSpawn"); |
502 | 503 | } |
503 | 504 | } |
504 | | - |
| 505 | + |
| 506 | + SetEntPropFloat(client, Prop_Data, "m_fLastPlayerTalkTime", 0.0); |
| 507 | + |
505 | 508 | if (!pauseProcessed) |
506 | 509 | { |
507 | 510 | sv_pausable.BoolValue = true; |
508 | 511 | FakeClientCommand(client, "pause"); |
509 | 512 | sv_pausable.BoolValue = false; |
510 | 513 | pauseProcessed = true; |
511 | 514 | } |
512 | | - |
| 515 | + |
513 | 516 | if (team == L4D2Team_Spectator) |
514 | 517 | { |
515 | 518 | sv_noclipduringpause.ReplicateToClient(client, "1"); |
@@ -542,6 +545,8 @@ void Unpause(bool real = true) |
542 | 545 | { |
543 | 546 | if (IsClientInGame(client) && !IsFakeClient(client)) |
544 | 547 | { |
| 548 | + SetEntPropFloat(client, Prop_Data, "m_fLastPlayerTalkTime", 0.0); |
| 549 | + |
545 | 550 | if(!unpauseProcessed) |
546 | 551 | { |
547 | 552 | sv_pausable.BoolValue = true; |
@@ -759,18 +764,20 @@ void ToggleCommandListeners(bool enable) |
759 | 764 | { |
760 | 765 | if (enable && !listened) |
761 | 766 | { |
762 | | - AddCommandListener(Say_Callback, "say"); |
763 | | - AddCommandListener(TeamSay_Callback, "say_team"); |
764 | 767 | AddCommandListener(Unpause_Callback, "unpause"); |
765 | 768 | AddCommandListener(Callvote_Callback, "callvote"); |
| 769 | + |
| 770 | + HookEvent("player_say", Event_PlayerSay, EventHookMode_Post); |
| 771 | + |
766 | 772 | listened = true; |
767 | 773 | } |
768 | 774 | else if (!enable && listened) |
769 | 775 | { |
770 | | - RemoveCommandListener(Say_Callback, "say"); |
771 | | - RemoveCommandListener(TeamSay_Callback, "say_team"); |
772 | 776 | RemoveCommandListener(Unpause_Callback, "unpause"); |
773 | 777 | RemoveCommandListener(Callvote_Callback, "callvote"); |
| 778 | + |
| 779 | + UnhookEvent("player_say", Event_PlayerSay, EventHookMode_Post); |
| 780 | + |
774 | 781 | listened = false; |
775 | 782 | } |
776 | 783 | } |
@@ -840,45 +847,22 @@ Action Callvote_Callback(int client, char[] command, int argc) |
840 | 847 | return Plugin_Handled; |
841 | 848 | } |
842 | 849 |
|
843 | | -Action Say_Callback(int client, char[] command, int argc) |
| 850 | +void Event_PlayerSay(Event hEvent, const char[] sEventName, bool bDontBroadcast) |
844 | 851 | { |
845 | | - if (isPaused) |
846 | | - { |
847 | | - char buffer[256]; |
848 | | - GetCmdArgString(buffer, sizeof(buffer)); |
849 | | - StripQuotes(buffer); |
850 | | - if (IsChatTrigger() || buffer[0] == '!' || buffer[0] == '/') // Hidden command or chat trigger |
851 | | - { |
852 | | - return Plugin_Handled; |
853 | | - } |
854 | | - if (client == 0) |
855 | | - { |
856 | | - PrintToChatAll("Console : %s", buffer); |
857 | | - } |
858 | | - else |
859 | | - { |
860 | | - CPrintToChatAllEx(client, "{teamcolor}%N{default} : %s", client, buffer); |
861 | | - } |
862 | | - return Plugin_Handled; |
863 | | - } |
864 | | - return Plugin_Continue; |
| 852 | + int iUserId = hEvent.GetInt("userid"); |
| 853 | + RequestFrame(FrameDelay_PlayerSay, iUserId); |
865 | 854 | } |
866 | 855 |
|
867 | | -Action TeamSay_Callback(int client, char[] command, int argc) |
| 856 | +void FrameDelay_PlayerSay(int iUserId) |
868 | 857 | { |
869 | | - if (isPaused) |
870 | | - { |
871 | | - char buffer[256]; |
872 | | - GetCmdArgString(buffer, sizeof(buffer)); |
873 | | - StripQuotes(buffer); |
874 | | - if (IsChatTrigger() || buffer[0] == '!' || buffer[0] == '/') // Hidden command or chat trigger |
875 | | - { |
876 | | - return Plugin_Handled; |
877 | | - } |
878 | | - PrintToTeam(client, GetClientTeam(client), buffer); |
879 | | - return Plugin_Handled; |
| 858 | + int iClient = GetClientOfUserId(iUserId); |
| 859 | + if (iClient < 1 || !isPaused) { |
| 860 | + return; |
880 | 861 | } |
881 | | - return Plugin_Continue; |
| 862 | + |
| 863 | + // During a pause the time (gpGlobals->curtime) does not change. |
| 864 | + // Let's reset this property for the chat to work. |
| 865 | + SetEntPropFloat(iClient, Prop_Data, "m_fLastPlayerTalkTime", 0.0); |
882 | 866 | } |
883 | 867 |
|
884 | 868 | Action Unpause_Callback(int client, char[] command, int argc) |
|
0 commit comments