Raised This Month: $51 Target: $400
 12% 

Solved Help with player_disconnect event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FrAgOrDiE
AlliedModders Donor
Join Date: May 2018
Location: Italy
Old 02-19-2020 , 19:25   Help with player_disconnect event
Reply With Quote #1

Hi, I build a plugin for a JailBreak server which gives a certain output when a penultimate player of CT team get killed by someone and a different output when a penultimate player of ct team die by himself, get slayed or get disconnected.



The problem is: if there are 2 player in ct team, one get killed and then he disconnect the plugin gives the wrong output. Can I get if a disconnected player was dead with player_disconnect event?


I attach the plugin.
Attached Files
File Type: sp Get Plugin or Get Source (ultimo_unico.sp - 113 views - 1.7 KB)

Last edited by FrAgOrDiE; 02-20-2020 at 07:45.
FrAgOrDiE is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 02-20-2020 , 03:29   Re: Help with player_disconnect event
Reply With Quote #2

You can track with a var, e.g.

bool g_bDead[MAXPLAYERS+1]

when a player dies set it to true, but I think that there may be some way to check if the client is dead during the disconnect, maybe check his life (HP), I don't play CSGO to be sure about that.
__________________
Marttt is offline
Riotline
AlliedModders Donor
Join Date: Oct 2015
Location: Half Life 3
Old 02-20-2020 , 05:29   Re: Help with player_disconnect event
Reply With Quote #3

Another thing you could try is use this IsValidClient check and add it to your conditional statements to check whether they are still a "Valid Client" as the function suggests.

I'm not sure if this function is the most efficient or current way to do it but this is what I have at the moment.

Code:
stock bool IsValidClient(int client, bool nobots = true)
{ 
	if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
	{ 
		return false; 
	} 
	return IsClientInGame(client); 
}
__________________
Riotline is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode