whats wrong with this code?

	kills = 1
	local function killscount(killer)
	kills = kills + 1
hook.Add("PlayerDeath", "killscount", killscount)

	draw.DrawText(""..kills, "TargetID", hx + 225, hy - 150, Kills2, 0)

im trying to make a kill-counter <3

The PlayerDeath hook is serverside, i cannot check the wiki due to fail laptop right now, but i believe you will need to use a usermessage from the server, there is probably a way around it of course :stuck_out_tongue:

The main problem is that you may only use the PlayerDeath hook serverside and drawing has to be done clientside.

so how do i fix that?

For this particular case the simplest solution is to use **[Player.Frags

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.Frags)** and it’s associated functions. Otherwise if that doesn’t suit you you will have to do the networking yourself.

Now everything that has to do with changing frags will have to be in a serverside file and the drawing functions in a client file.

well, how can i make my cl_init file to import that virable?, i cant put “…bestplayer”

draw.DrawText(""..bestplayer, "TargetID", hx + 225, hy - 100, bestplayer, 0)

Don’t use the code snippet from the example unless it’s related to what you want to do with the function.
First what exactly do you want to do? Display to a user how many kills someone else has? Display your own kills? Display a team score.

You too you have a fail laptop?

doesnt matter :/, i just want to display kills but i just used name as example

Who doesn’t?, and i completely forgot about the Frags function :(.

function GM:HUDPaint()
local p = LocalPlayer()
draw.DrawText(p:Frags( ), “TargetID”, hx + 225, hy - 150, Kills2, 0)

If it’s not to late.

this is really old :smiley: