-- cod zombie points system recreated -- tried to make it for survival_escalation UPGRADE_UPGRADE = 0; UPGRADE_APPLY = 1; UPGRADE_DOWNGRADE = 2; UPGRADE_RESTORE = 3; player_list = {}; cashmult = 0; function MULT(value, activator) local userid = activator:GetUserId(); if (not activator or not player_list[userid]) then return; end value = tonumber(value); cashmults = player_list[userid].cashmult if (value == UPGRADE_UPGRADE) then cashmults = player_list[userid].cashmult + 1; elseif (value == UPGRADE_DOWNGRADE) then cashmults = player_list[userid].cashmult - 1; elseif (value == UPGRADE_RESTORE) then local upgradeval = activator:GetAttributeValue("kill eater user 1"); if (not upgradeval) then cashmults = 0; end end end 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) -- PrintTable(damageInfo) local damage = damageInfo.Damage if damage <= 0 then return end local damageType = damageInfo.DamageType local hitter = damageInfo.Attacker if (damageType & DMG_BURN) ~= 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 local mult = hitter.cashmult + 1 local function addCurrency(amount) hitter:AddCurrency(amount * mult) end --[[ if not isLethal then ]] addCurrency(0) --[[ return end if IsLethal then addCurrency(75) return end if (damageType & DMG_BLAST) ~= 0 then addCurrency(20) -- used to be 50 -- print("explosive?") elseif (damageType & DMG_MELEE) ~= 0 then addCurrency(60) -- print("melee?") elseif (damageType & DMG_MELEE) == 0 and (damageType & DMG_CRITICAL) ~= 0 then -- this is used for headshots, may overlap with Instakill addCurrency(80) -- print("crit?") elseif (damageType & DMG_BULLET) ~= 0 then addCurrency(15) -- print("bullet?") elseif (damageType & DMG_USE_HITLOCATIONS) ~= 0 then addCurrency(100) -- print("fancier bullet?") else addCurrency(20) -- print("hell if I know") end ]] end) callbacks.killed = activator:AddCallback(ON_DEATH, function(_, damageInfo) -- PrintTable(damageInfo) local damage = damageInfo.Damage if damage <= 0 then return end local damageType = damageInfo.DamageType local hitter = damageInfo.Attacker if (damageType & DMG_BURN) ~= 0 then return end local isCrit = (damageType & DMG_CRITICAL) ~= 0 if isCrit then damage = damage * 3 end local curHealth = activator.m_iHealth local mult = hitter.cashmult + 1 local function addCurrency(amount) hitter:AddCurrency(amount * mult) end if (damageType & DMG_BLAST) ~= 0 then addCurrency(20) -- used to be 50 -- print("explosive?") elseif (damageType & DMG_MELEE) ~= 0 then addCurrency(60) -- print("melee?") elseif (damageType & DMG_MELEE) == 0 and (damageType & DMG_CRITICAL) ~= 0 then -- this is used for headshots, may overlap with Instakill addCurrency(80) -- print("crit?") elseif (damageType & DMG_BULLET) ~= 0 then addCurrency(15) -- print("bullet?") elseif (damageType & DMG_USE_HITLOCATIONS) ~= 0 then addCurrency(100) -- print("fancier bullet?") else addCurrency(20) -- print("hell if I know") 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