|
@@ -8,7 +8,7 @@
|
|
|
|
|
|
#pragma newdecls required
|
|
|
|
|
|
-#define PLUGIN_VERSION "1.1.0"
|
|
|
+#define PLUGIN_VERSION "1.1.1"
|
|
|
public Plugin myinfo = {
|
|
|
name = "[CSRD] `jointeam` Fix",
|
|
|
author = "nosoop",
|
|
@@ -40,20 +40,8 @@ public void OnPluginStart() {
|
|
|
* redisplaying the team select panel.
|
|
|
*/
|
|
|
Action OnClientJoinTeam(int client, const char[] command, int argc) {
|
|
|
- if (!client || GetClientTeam(client)) {
|
|
|
- return Plugin_Continue;
|
|
|
- }
|
|
|
-
|
|
|
- float flNextAllowedTeamChange = GetEntDataFloat(client,
|
|
|
- offs_CTFPlayer_flNextTimeAllowTeamChange);
|
|
|
- if (flNextAllowedTeamChange > GetGameTime()) {
|
|
|
- // we're not allowed to change teams right now --
|
|
|
- // silently block the attempt then redisplay once the cooldown is over
|
|
|
- CreateTimer(0.1 + flNextAllowedTeamChange - GetGameTime(), RedisplayTeamSelectMenu,
|
|
|
- GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE);
|
|
|
- return Plugin_Handled;
|
|
|
- }
|
|
|
- return Plugin_Continue;
|
|
|
+ // block the command if we're resending on a `jointeam` cooldown
|
|
|
+ return client && QueueResendTeamChangePanel(client)? Plugin_Handled : Plugin_Continue;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -75,21 +63,27 @@ Action OnVGUIMenuPreSent(UserMsg vguiMessage, BfRead buffer, const int[] players
|
|
|
}
|
|
|
|
|
|
int client = players[0];
|
|
|
+
|
|
|
+ // block the message if we're resending on a `jointeam` cooldown
|
|
|
+ return QueueResendTeamChangePanel(client)? Plugin_Handled : Plugin_Continue;
|
|
|
+}
|
|
|
+
|
|
|
+bool QueueResendTeamChangePanel(int client) {
|
|
|
+ // return early if client is assigned to a team
|
|
|
if (GetClientTeam(client)) {
|
|
|
- return Plugin_Continue;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
float flNextAllowedTeamChange = GetEntDataFloat(client,
|
|
|
offs_CTFPlayer_flNextTimeAllowTeamChange);
|
|
|
if (flNextAllowedTeamChange > GetGameTime()) {
|
|
|
- // we're not allowed to change teams right now --
|
|
|
- // silently block the attempt then redisplay once the cooldown is over
|
|
|
+ // we're not allowed to change teams right now, so set a timer to redisplay
|
|
|
CreateTimer(0.1 + flNextAllowedTeamChange - GetGameTime(), RedisplayTeamSelectMenu,
|
|
|
GetClientSerial(client), TIMER_FLAG_NO_MAPCHANGE);
|
|
|
- return Plugin_Handled;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
- return Plugin_Continue;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|