kill counter track nextbots

This commit is contained in:
Darsu 2024-04-23 21:38:39 +07:00
parent 657760b201
commit 5f69e1ac06
5 changed files with 23 additions and 1 deletions

View File

@ -15,4 +15,13 @@ end)
net.Receive("arc9_stoppickup", function(len)
LocalPlayer().ARC9_HoldingProp = nil
end)
net.Receive("arc9_sendnpckill", function(len)
local ent = net.ReadEntity()
local wpn = LocalPlayer():GetActiveWeapon()
if IsValid(wpn) and wpn.ARC9 then
wpn:RunHook("Hook_OnKill", ent)
end
end)

View File

@ -63,7 +63,7 @@ ATT.Hook_OnKill = function(self, ent)
sql.Query("INSERT INTO arc9_killcounter (weapon, npckills, playerkills) VALUES ('" .. weapon .. "', 0, 0)")
end
if ent:IsNPC() then
if ent:IsNPC() or ent:IsNextBot() then
npckills = npckills + 1
sql.Query("UPDATE arc9_killcounter SET npckills = " .. npckills .. " WHERE weapon = '" .. weapon .. "'")
else

View File

@ -12,6 +12,7 @@ util.AddNetworkString("arc9_randomizeatts")
util.AddNetworkString("arc9_sendblacklist")
util.AddNetworkString("arc9_proppickup")
util.AddNetworkString("arc9_stoppickup")
util.AddNetworkString("arc9_sendnpckill")
if game.SinglePlayer() then

View File

@ -26,6 +26,17 @@ hook.Add( "entity_killed", "entity_killed_example", function( data )
end
end )
hook.Add("OnNPCKilled", "ARC9_OnNPCKilled", function(npc, attacker, inflictor)
local wpn = attacker:GetActiveWeapon()
if IsValid(wpn) and wpn.ARC9 then
wpn:RunHook("Hook_OnKill", npc)
net.Start("arc9_sendnpckill")
net.WriteEntity(npc)
net.Send(attacker)
end
end)
timer.Simple(10, function() -- tfa does same thing, no need to copy (timer here cuz tfa loads after arc9)
if !TFA then
-- code stolen from wiki

View File

@ -12,4 +12,5 @@
"animatedtextureframenumvar" "$frame"
"animatedtextureframerate" 25.00
}
}
}