Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/autopause.sp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void Event_PlayerDisconnect(Event hEvent, char[] sEventName, bool dontBroadcast)
if (!teamPlayers.ContainsKey(sAuthId))
return;

if (GetClientTeam(client) == L4D_TEAM_SURVIVOR && !IsPlayerAlive(client))
if (IsClientInGame(client) && GetClientTeam(client) == L4D_TEAM_SURVIVOR && !IsPlayerAlive(client))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This seems to only be needed when you create your own player_disconnect event.
Normally this event is guaranteed to have the client still considered in-game.

I'd suggest fixing this in your other plugins that are creating a manual player_disconnect event.

{
if (convarDebug.BoolValue)
{
Expand Down
2 changes: 1 addition & 1 deletion addons/sourcemod/scripting/bequiet.sp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Action TeamSay_Callback(int client, char[] command, int args)
return Plugin_Handled;
}

if (bSpecSeeChat && GetClientTeam(client) != 1)
if (bSpecSeeChat && IsValidClient(client) && GetClientTeam(client) != 1)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

After looking at this plugin's code, my eyes started hurting 😅
I'd suggest leaving this plugin out of the PR for now, this one needs a rewrite.

{
char sChat[256];
GetCmdArgString(sChat, 256);
Expand Down
6 changes: 4 additions & 2 deletions addons/sourcemod/scripting/l4d2_ghost_warp.sp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ Action Cmd_WarpToSurvivor(int iClient, int iArgs)
return Plugin_Handled;
}

if (GetClientTeam(iClient) != L4D2Team_Infected
if (!IsClientInGame(iClient)
|| GetClientTeam(iClient) != L4D2Team_Infected
|| GetEntProp(iClient, Prop_Send, "m_isGhost", 1) < 1
|| !IsPlayerAlive(iClient)
) {
Expand Down Expand Up @@ -225,7 +226,8 @@ void Hook_OnPostThinkPost(int iClient)
return;
}

if (GetClientTeam(iClient) != L4D2Team_Infected
if (!IsClientInGame(iClient)
Comment thread
apples1949 marked this conversation as resolved.
|| GetClientTeam(iClient) != L4D2Team_Infected
|| GetEntProp(iClient, Prop_Send, "m_isGhost", 1) < 1
|| !IsPlayerAlive(iClient)
) {
Expand Down
4 changes: 4 additions & 0 deletions addons/sourcemod/scripting/playermanagement.sp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,10 @@ stock int GetPummelQueueAttacker(int client)

stock L4D2Team GetClientTeamEx(int client)
{
if (!IsClientInGame(client))
Comment thread
apples1949 marked this conversation as resolved.
{
return L4D2Team_None;
}
return view_as<L4D2Team>(GetClientTeam(client));
}

Expand Down
4 changes: 2 additions & 2 deletions addons/sourcemod/scripting/readyup/player.inc
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ void SetClientFrozen(int client, bool freeze)

bool IsPlayer(int client)
{
int team = GetClientTeam(client);
return (team == L4D2Team_Survivor || team == L4D2Team_Infected);
return IsClientInGame(client) && IsClientConnected(client)
Comment thread
apples1949 marked this conversation as resolved.
&& (GetClientTeam(client) == L4D2Team_Survivor || GetClientTeam(client) == L4D2Team_Infected);
}

void ReturnPlayerToSaferoom(int client, bool flagsSet = true)
Expand Down