local function cashforhits(activator) local callbacks = {} local function removeCallbacks() for _, callbackId in pairs(callbacks) do activator:RemoveCallback(callbackId) end end callbacks.damagetype = activator:AddCallback(ON_DAMAGE_RECEIVED_PRE, function(_, damageInfo) local damage = damageInfo.Damage if damage <= 0 then return end local damageType = damageInfo.DamageType local hitter = damageInfo.Attacker if (damageType & TF_DMG_CUSTOM_BURNING) ~= 0 then return end local isCrit = (damageType & DMG_CRITICAL) ~= 0 if isCrit then damage = damage * 3 end local curHealth = activator.m_iHealth local isLethal = curHealth - (damage + 1) <= 0 if not isLethal then hitter:AddCurrency(0) return end if (damageType & DMG_BLAST) ~= 0 then hitter:AddCurrency(15) elseif (damageType & DMG_MELEE) == 0 and (damageType & DMG_CRITICAL) ~= 0 then hitter:AddCurrency(25) elseif (damageType & DMG_MELEE) ~= 0 then hitter:AddCurrency(35) else hitter:AddCurrency(15) end end) callbacks.spawned = activator:AddCallback(1, function() removeCallbacks() end) callbacks.died = activator:AddCallback(9, function() removeCallbacks() end) end function OnWaveSpawnBot(bot) timer.Simple(1, function() cashforhits(bot) end) end