Skip to content

Commit b38dd10

Browse files
committed
Ignore disconnect player_team events and restore delayed userid-based rate adjustment
1 parent 0b6f351 commit b38dd10

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

addons/sourcemod/scripting/specrates.sp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,20 @@ public void OnClientPutInServer(int client)
132132

133133
void OnTeamChange(Event event, const char[] name, bool dontBroadcast)
134134
{
135-
RequestFrame(OnNextFrame_AdjustRates, event.GetInt("userid"));
135+
if (event.GetBool("disconnect"))
136+
return;
137+
138+
CreateTimer(10.0, TimerAdjustRates, event.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE);
136139
}
137140

138-
void OnNextFrame_AdjustRates(any userid)
141+
Action TimerAdjustRates(Handle timer, any userid)
139142
{
140143
int client = GetClientOfUserId(userid);
141144
if (!IsValidClient(client))
142-
return;
145+
return Plugin_Handled;
143146

144147
AdjustRates(client);
148+
return Plugin_Handled;
145149
}
146150

147151
public void OnClientSettingsChanged(int client)
@@ -231,4 +235,4 @@ stock L4DTeam L4D_GetClientTeam(int client)
231235
{
232236
int team = GetClientTeam(client);
233237
return view_as<L4DTeam>(team);
234-
}
238+
}

0 commit comments

Comments
 (0)