• Spawning a prop increases your kills?
    4 replies, posted
Hello, On gametracker, it doesn't record players on my server unless they have kills, which is hard since it's a no-kill build server. Is there a way to increase the score every time a prop is spawned, and decrease kills when it's removed? Thanks.
[lua] hook.Add("PlayerSpawnedProp", "abc", function(ply, model, ent) ent.ply = ply ply:SetFrags(ply:Frags() + 1) end) hook.Add("EntityRemoved", "cba", function(ent) if ent.ply then ply:SetFrags(ply:Frags() - 1) end end) [/lua] Untested but should work. Goes in server autorun folder.
Kinda strange concept.
[QUOTE=20 Smartness;25625228][lua] hook.Add("PlayerSpawnedProp", "abc", function(ply, model, ent) ent.ply = ply ply:SetFrags(ply:Frags() + 1) end) hook.Add("EntityRemoved", "cba", function(ent) if ent.ply then ply:SetFrags(ply:Frags() - 1) end end) [/lua] Untested but should work. Goes in server autorun folder.[/QUOTE] its not going to because ply doesn't exist in the last hook.
[lua] timer.Create('UpdateScore', 5, 0, function() for k, v in ipairs(player.GetAll()) do v:SetFrags(v:GetCount('props')) end end) [/lua]
Sorry, you need to Log In to post a reply to this thread.