Hello people of facepunch what im trying to do is make a simple killercounter and what i seem to do isnt working what i did is use the Frags command, but it does not count my kills.
I am also not sure if this is a glitch because i spawn in people then use my guns to kill them, it could be because they arent actualy players, im not sure help if you can.
[code]
local frame = vgui.Create("DFrame")
frame:SetPos(50, 25)
frame:SetSize(250, 100)
frame:SetTitle("Kill counter")
frame:SetDraggable(false)
frame:SetVisible(true)
frame:ShowCloseButton(true)
frame.Paint = function()
draw.RoundedBox( 8, 0, 0, frame:GetWide(), frame:GetTall(), Color( 0, 0, 0, 255 ) )
surface.SetTextColor(255, 255, 255)
surface.SetTextPos(50, 50)
surface.DrawText("Kill count: " .. LocalPlayer():Frags() )
end
[/code]
Notice: This is extremely ugly, but its just to show him how its done. (im novice at Lua as well :) )
this is just to show you how its done, you can basically do the same thing with your hud. just cut the DFrame, then just draw text("kill count: ".. LocalPlayer():Frags() )
put this in(example): E:\steam\SteamApps\common\GarrysMod\garrysmod\lua
then type lua_openscript_cl luafilename
Edit: For the record the kill counter does also work with Bots, the once you spawn through console like you did, you probably just didn't make the counter right.
Sorry, you need to Log In to post a reply to this thread.