Add heal detection

This commit is contained in:
Jackz 2022-08-24 11:00:59 -05:00
parent 0e7a48b609
commit dd2f1b45bd
No known key found for this signature in database
GPG key ID: E0BBD94CF657F603
2 changed files with 15 additions and 5 deletions

Binary file not shown.

View file

@ -35,7 +35,7 @@ Bile Detections:
*/
stock bool IsPlayerBoomed(int client) {
return GetEntPropFloat(%0, Prop_Send, "m_vomitStart") + 20.1 > GetGameTime();
return GetEntPropFloat(client, Prop_Send, "m_vomitStart") + 20.1 > GetGameTime();
}
stock bool IsAnyPlayerBoomed() {
for(int i = 1; i <= MaxClients; i++) {
@ -50,7 +50,7 @@ stock bool AnyRecentBileInPlay(int ignore) {
return false;
}
stock int GetEntityCountNear(const float[3] srcPos, float radius = 50000.0) {
stock int GetEntityCountNear(const float srcPos[3], float radius = 50000.0) {
float pos[3];
int count;
int entity = -1;
@ -74,7 +74,7 @@ stock int L4D_SpawnCommonInfected2(const float vPos[3], const float vAng[3] = {
return entity;
}
PlayerDetections[MAXPLAYERS+1] detections;
PlayerDetections detections[MAXPLAYERS+1];
GlobalForward fwd_PlayerDoubleKit, fwd_NoHordeBileWaste, fwd_DoorFaceCloser, fwd_CheckpointDoorFaceCloser;
@ -100,6 +100,7 @@ public void OnPluginStart() {
HookEvent("item_pickup", Event_ItemPickup);
HookEvent("door_close", Event_DoorClose);
HookEvent("heal_success", Event_HealSuccess);
}
// Called on map changes too, we want this:
@ -107,7 +108,7 @@ public void OnClientDisconnect(int client) {
detections[client].Reset();
}
public Action Event_ItemPickup(Event event, const char[] name, bool dontBroadcast) {
public void Event_ItemPickup(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client && L4D_IsInLastCheckpoint(client)) {
static char itmName[32];
@ -123,7 +124,16 @@ public Action Event_ItemPickup(Event event, const char[] name, bool dontBroadcas
}
}
public Action Event_DoorClose(Event event, const char[] name, bool dontBroadcast) {
public void Event_HealSuccess(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(client) {
int target = GetClientOfUserId(event.GetInt("subject"));
int amount = event.GetInt("health_restored");
PrintToConsoleAll("[Debug] %N healed %N (+%d health)", client, target, amount);
}
}
public void Event_DoorClose(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
if(fwd_DoorFaceCloser.FunctionCount > 0 && client) {
bool isCheckpoint = event.GetBool("checkpoint");