-
Notifications
You must be signed in to change notification settings - Fork 154
Fix bug by player not in game for some plugins(no compiled plugin) #972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After looking at this plugin's code, my eyes started hurting 😅 |
||
| { | ||
| char sChat[256]; | ||
| GetCmdArgString(sChat, 256); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
| ) { | ||
|
|
@@ -225,7 +226,8 @@ void Hook_OnPostThinkPost(int iClient) | |
| return; | ||
| } | ||
|
|
||
| if (GetClientTeam(iClient) != L4D2Team_Infected | ||
| if (!IsClientInGame(iClient) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need this check, clients are hooked when they enter ghost state which they cannot do if they're not in-game. |
||
| || GetClientTeam(iClient) != L4D2Team_Infected | ||
| || GetEntProp(iClient, Prop_Send, "m_isGhost", 1) < 1 | ||
| || !IsPlayerAlive(iClient) | ||
| ) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -560,6 +560,10 @@ stock int GetPummelQueueAttacker(int client) | |
|
|
||
| stock L4D2Team GetClientTeamEx(int client) | ||
| { | ||
| if (!IsClientInGame(client)) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the right place to do this, all the other locations already check if the client is in game before calling this. |
||
| { | ||
| return L4D2Team_None; | ||
| } | ||
| return view_as<L4D2Team>(GetClientTeam(client)); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IsClientInGame will return false if a client is not connected, you don't need both checks. Initially I was going to ask to address the location itself ( |
||
| && (GetClientTeam(client) == L4D2Team_Survivor || GetClientTeam(client) == L4D2Team_Infected); | ||
| } | ||
|
|
||
| void ReturnPlayerToSaferoom(int client, bool flagsSet = true) | ||
|
|
||
There was a problem hiding this comment.
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_disconnectevent.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.