could use some help with GM:OnNPCKilled

I am working on zombie survival and trying to edit a few functions. I have added zombie npc’s like in zombie outbreak. I need help with setting up a function or a few functions that add points when you kill a zombie npc’s. I am talking headcrabs,fast zombies,normal zombies, zombie torso’s,poison zombies and poison headcrabs. I have a function like this set up/ well that’s what i been working with.


 function GM:OnNPCKilled(ent, attacker, inflictor)
	if NPCS and attacker:IsPlayer() and attacker:Team() == TEAM_HUMAN then
		attacker:AddPoints(7)
		self:CheckPlayerScore(attacker)
	end
end



I do not know much about Lua. I am more use to older MSDOS. I been trying to teach myself Lua but it has been rough going and i don’t have much time for it right now.

I also used these resources https://wiki.garrysmod.com/page/GM/OnNPCKilled
https://facepunch.com/threads/showthread.php?t=1000463
https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7b43.html
https://www.youtube.com/watch?v=o-uVdG4fra4

I am not sure what is out of date and what is up to date.

I also have other code. well code from zombie outbreak/deathlegends and would like to possible use some of it in my gamemode. There gamemode works, well kinda right now there is a problem with the wraith models I have heard but have not confirmed this.

I changed some code in zombie survival and basicly turned it into zombie outbreak. I need help with making it so when you kill zombies you get points. I see in the code that after 60 secs of not getting hurt you get 2 points. that is the only point system i could find in zombie survival and tried to applied it to the GM:OnNPCKilled function. when i played around with it. i did get it so i did not get error’s in the console but then again points did not register eithermaybe has to do with “net messages”?

Two things, make sure the function is running by putting a print message in there and what is NPCS?

You put “if NPCS”, why?

sorry yeah i was really drunk and probly sound like a russian. i been under a lot of stress. see the thing is i had other code i stole and copyed and eidited to try and make stuff work. cause i thought being lazy and finding a easyer way might help. but it dont. i need to learn and its hard for me.

i somehow accendently hacked a fast download server well not really i just google onnpcekilled and find stuff
http://conjointgaming.com/fastdl/gameservers/garrysmodzs/gamemodes/zombiesurvival/gamemode/init.lua

i am pretty sure that zombie outbreak is based off a old noxiousnet version of zombie survival and that is why stuff does not match up. its a big conspiracy

[editline]6th December 2016[/editline]

i just want education on how to write a basic function in the zombie survival environment with zombie npc’s when they die they give you points that you can buy better guns with thanks

Wow, I mean if you hacked a FastDL, something that puts the files on your client, you must be good. Come back when you can spell, make sense and have context in whatever you’re saying. For now, just close the thread. This isn’t a forum to help script kiddies. If you want to learn, go learn how to program in Lua. Go google “How to program in Lua” or “Programming in Lua basics”. It’s not that hard.

right figured as much thanks anyways

[editline]6th December 2016[/editline]

*resolved

If you want to write a function




local function functionname ()

--stuff in your function here

end

functionname() --This calls it.