So I have this weird problem that I have been trying to work out for a couple of hours. I am making a kill feed.
(going for something similar to this)
[video=youtube;En3-DEmdKtw]https://www.youtube.com/watch?v=En3-DEmdKtw[/video]
Here is my code--
init.lua--
[CODE]
function GM:PlayerDeath( victim, inflictor, attacker )
if ( victim == attacker ) then
attacker:PrintMessage( HUD_PRINTTALK, "You have killed yourself." )
attacker:TakePoints( 100 )
else
attacker:SetNWInt("plyXP", attacker:GetNWInt("plyXP") + 100 )
attacker:AddPoints(100)
attacker:SavePoints()
levelcheck(attacker)
if attacker:IsPlayer() then
attacker:SetNWInt("KC", attacker:CurKC() + 1)
timer.Start("KFStack")
if attacker:CurKC() >= 5 then attacker:SetNWInt("KC", 5) end
end
timer.Create("KFStack", 2, 1, function()
attacker:SetNWInt("KC", 0) print("Hey") end )
end
text = "[ Enemy Killed ] " .. victim:Nick()
net.Start("HKF")
net.WriteString( text )
if k1 then net.WriteString( k1 ) end
if k2 then net.WriteString( k2 ) end
if k3 then net.WriteString( k3 ) end
if k4 then net.WriteString( k4 ) end
if k5 then net.WriteString( k5 ) end
net.Send( attacker )
if attacker:CurKC() == 1 then PrintMessage( HUD_PRINTTALK, "Kill-1" ) k1 = text end
if attacker:CurKC() == 2 then PrintMessage( HUD_PRINTTALK, "Kill-2" ) k2 = text end
if attacker:CurKC() == 3 then PrintMessage( HUD_PRINTTALK, "Kill-3" ) k3 = text end
if attacker:CurKC() == 4 then PrintMessage( HUD_PRINTTALK, "Kill-4" ) k4 = text end
if attacker:CurKC() == 5 then PrintMessage( HUD_PRINTTALK, "Kill-5" ) k5 = text end
end
[/CODE]
heres cl_init.lua--
[CODE]
-- this is in HUDPaint
if client:CurKC() > 0 && AnimTime == 1 then
HKFalpha = math.Approach(HKFalpha, 0, -7 ) end
if client:CurKC() >= 1 then
draw.SimpleText( k1r, "hud_roboto_lt", ScrW()/2 - (5 * (string.len( tostring( k1r ) ))), ScrH()/2 + 200, Color(255, 50, 150, HKFalpha ) )
end
if client:CurKC() >= 2 then
draw.SimpleText( k2r, "hud_roboto_lt", ScrW()/2 - (5 * (string.len( tostring( k2r ) ))), ScrH()/2 + 250, Color(255, 50, 150, HKFalpha ) )
end
if client:CurKC() >= 3 then
draw.SimpleText( k3r, "hud_roboto_lt", ScrW()/2 - (5 * (string.len( tostring( k3r ) ))), ScrH()/2 + 300, Color(255, 50, 150, HKFalpha ) )
end
if client:CurKC() >= 4 then
draw.SimpleText( k4r, "hud_roboto_lt", ScrW()/2 - (5 * (string.len( tostring( k4r ) ))), ScrH()/2 + 350, Color(255, 50, 150, HKFalpha ) )
end
if client:CurKC() >= 5 then
draw.SimpleText( k5r, "hud_roboto_lt", ScrW()/2 - (5 * (string.len( tostring( k5r ) ))), ScrH()/2 + 400, Color(255, 50, 150, HKFalpha ) )
end
if client:CurKC() == 2 then
draw.SimpleText( "x2 DOUBLE KILL", "hud_exo", ScrW()/2 + 150, ScrH()/2 + 250, Color( 20, 255, 255 ) )
end
if client:CurKC() == 3 then
draw.SimpleText( "3x TRIPLE KILL", "hud_exo", ScrW()/2 + 150, ScrH()/2 + 300, Color( 20, 255, 255 ) )
end
if client:CurKC() >= 4 then
draw.SimpleText( "MULTI KILL", "hud_exo", ScrW()/2 + 150, ScrH()/2 + 350, Color( 20, 255, 255 ) )
end
[/CODE]
Anyway what ends up happening is I kill a bot, then kill another and their names are all messed up. Look at this video and see what I mean.
[video] [url]https://youtu.be/H_O7_vKMeak[/url] [/video]
Notice how I kill one bot and it says I have killed the other.
Rarely does it say I even killed the right person.
So if anyone can see some sort of pattern here or something I did wrong here, please help me out! Thanks in advance :)
Guess I stumped a few people? Or is this asking for too much?
Have you tested it with actual players? Also, nice design, I really like it!
I'll get into it more when I'm home, seems interesting.
[QUOTE=Kiro The Pro;50772534]Have you tested it with actual players? Also, nice design, I really like it!
I'll get into it more when I'm home, seems interesting.[/QUOTE]
Yes I have. The result is the same. :/
Sorry, you need to Log In to post a reply to this thread.