From c22297b1a0e63f644ee6bf809f2f7f9e0eea5ceb Mon Sep 17 00:00:00 2001 From: zaCade Date: Thu, 11 Oct 2018 16:30:11 +0200 Subject: [PATCH] BossHP: Remove first version of damage callback. --- BossHP/scripting/BossHP.sp | 100 ------------------------------------- 1 file changed, 100 deletions(-) diff --git a/BossHP/scripting/BossHP.sp b/BossHP/scripting/BossHP.sp index ce708637..a49e9224 100644 --- a/BossHP/scripting/BossHP.sp +++ b/BossHP/scripting/BossHP.sp @@ -312,9 +312,6 @@ public void OnMapStart() OnEntitySpawned(entity); } } - - AddFileToDownloadsTable("materials/overlays/hitmarker/hitmarkerv2.vmt"); - AddFileToDownloadsTable("materials/overlays/hitmarker/hitmarkerv2.vtf"); } public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) @@ -437,60 +434,6 @@ public void OnEntitySpawned(int entity) LogMessage("Hooked killtrigger %s:%s", sKillTrigger, sKillOutput); } } - - for(int i = 0; i < g_aConfig.Length; i++) - { - CConfig _Config = g_aConfig.Get(i); - - if (_Config.IsBreakable) - { - CConfigBreakable Config = view_as(_Config); - - char sBreakable[64]; - Config.GetBreakable(sBreakable, sizeof(sBreakable)); - - if (StrEqual(sBreakable, sTargetname)) - HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false); - } - else if (_Config.IsCounter) - { - CConfigCounter Config = view_as(_Config); - - char sCounter[64]; - Config.GetCounter(sCounter, sizeof(sCounter)); - - char sOperation[64]; - if (Config.bCounterReverse) - sOperation = "Add"; - else - sOperation = "Subtract"; - - if (FindOutput(entity, "m_OnHealthChanged", 0, sCounter) != -1) - HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false); - - if (FindOutput(entity, "m_OnDamaged", 0, sCounter) != -1) - HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false); - } - else if (_Config.IsHPBar) - { - CConfigHPBar Config = view_as(_Config); - - char sCounter[64]; - Config.GetCounter(sCounter, sizeof(sCounter)); - - char sOperation[64]; - if (Config.bCounterReverse) - sOperation = "Add"; - else - sOperation = "Subtract"; - - if (FindOutput(entity, "m_OnHealthChanged", 0, sCounter) != -1) - HookSingleEntityOutput(entity, "OnHealthChanged", HookCallbackDamagedBoss, false); - - if (FindOutput(entity, "m_OnDamaged", 0, sCounter) != -1) - HookSingleEntityOutput(entity, "OnDamaged", HookCallbackDamagedBoss, false); - } - } } void OnTrigger(int entity, const char[] output, SDKHookType HookType = view_as(-1)) @@ -1324,46 +1267,3 @@ int FindEntityByTargetname(int entity, const char[] sTargetname, const char[] sC return INVALID_ENT_REFERENCE; } - -stock int IsValidClient(int client, bool nobots = true) -{ - if (client <= 0 || client > MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client))) - return false; - - return IsClientInGame(client); -} - -// Show overlay to a client with lifetime | 0.0 = no auto remove -stock void ShowOverlay(int client, char[] path, float lifetime) -{ - if (!IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client)) - return; - - ClientCommand(client, "r_screenoverlay \"%s.vtf\"", path); - - if (lifetime != 0.0) - CreateTimer(lifetime, DeleteOverlay, GetClientUserId(client)); -} - -// Remove overlay from a client - Timer! -stock Action DeleteOverlay(Handle timer, any userid) -{ - int client = GetClientOfUserId(userid); - if (client <= 0 || !IsClientInGame(client) || IsFakeClient(client) || IsClientSourceTV(client) || IsClientReplay(client)) - return; - - ClientCommand(client, "r_screenoverlay \"\""); -} - -public void HookCallbackDamagedBoss(const char[] output, int caller, int activator, float delay) -{ - if (IsValidClient(activator)) - { - int iCurrentCash = GetEntProp(activator, Prop_Send, "m_iAccount"); - - if (iCurrentCash < 16000) - SetEntProp(activator, Prop_Send, "m_iAccount", iCurrentCash + 1); - - ShowOverlay(activator, "overlays/hitmarker/hitmarkerv2", 0.25); - } -} \ No newline at end of file