• Custom Killlicon when calling Player:Kill()
    1 replies, posted
Hello everyone! I have a disease system on my server and I want to edit it so when a player dies(the player gets killed by calling Player:Kill()) from an ilness, a killicon of that ilness is displayed. How can I get a custom killicon to display?
Not sure if this is the correct way to go about it but the concept works. Register that the player died by a disease before calling :Kill(), include the class/type if there's multiple. Override the PlayerDeath hook and spawn your own death notice if the player died by disease. if SERVER then util.AddNetworkString("customIcon") concommand.Add("killme", function(ply) ply.requestedKill = true ply.requestedType = "example_class" ply:Kill() end) hook.Add("PlayerDeath", "customIcon", function(victim) if victim.requestedKill ~= true then return end net.Start("customIcon") net.WriteEntity(victim) net.WriteString(victim.requestedType) net.Broadcast() victim.requestedKill = nil victim.requestedType = nil return true end) return end killicon.AddFont("example_class", "HL2MPTypeDeath", "-", Color(255,255,255)) local gm = gmod.GetGamemode() net.Receive("customIcon", function() local victim = net.ReadEntity() local class = net.ReadString() gm:AddDeathNotice( "", -1, class, victim:Name(), victim:Team() ) end)
Sorry, you need to Log In to post a reply to this thread.