2014-10-02 08:49:54 +08:00
|
|
|
function GM:ReceivedCommission(crate, buyer, points)
|
|
|
|
gamemode.Call("FloatingScore", crate, "floatingscore_com", points)
|
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function GM:HealedOtherPlayer(other, health)
|
|
|
|
gamemode.Call("FloatingScore", other, "floatingscore_heal", health, nil, true)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
function GM:RepairedObject(other, health)
|
|
|
|
gamemode.Call("FloatingScore", other, "floatingscore_rep", health, nil, true)
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local cvarNoFloatingScore = CreateClientConVar("zs_nofloatingscore", 0, true, false)
|
2014-11-10 07:28:31 +08:00
|
|
|
function GM:FloatingScore(victim, effectname, frags, flags, override_allow)
|
|
|
|
if cvarNoFloatingScore:GetBool() then return end
|
|
|
|
|
2014-10-02 08:49:54 +08:00
|
|
|
local isvec = type(victim) == "Vector"
|
|
|
|
|
2018-05-02 06:32:59 +08:00
|
|
|
if not isvec and (not victim:IsValid() or victim:IsPlayer() and victim:Team() == MySelf:Team() and not override_allow) then
|
|
|
|
return
|
2014-11-10 07:28:31 +08:00
|
|
|
end
|
2014-10-02 08:49:54 +08:00
|
|
|
|
|
|
|
effectname = effectname or "floatingscore"
|
|
|
|
|
|
|
|
local pos = isvec and victim or victim:NearestPoint(EyePos())
|
|
|
|
|
|
|
|
local effectdata = EffectData()
|
|
|
|
effectdata:SetOrigin(pos)
|
|
|
|
effectdata:SetScale(flags or 0)
|
|
|
|
if effectname == "floatingscore_und" then
|
2018-05-02 06:32:59 +08:00
|
|
|
effectdata:SetMagnitude(math.Round(frags or GAMEMODE.ZombieClasses[victim:GetZombieClass()].Points or 1, 2))
|
2014-10-02 08:49:54 +08:00
|
|
|
else
|
2018-05-02 06:32:59 +08:00
|
|
|
effectdata:SetMagnitude(math.Round(frags or 1, 2))
|
2014-10-02 08:49:54 +08:00
|
|
|
end
|
|
|
|
util.Effect(effectname, effectdata, true, true)
|
|
|
|
end
|