1-Hit Knife Lua Errors

I just updated my gmod ttt server and whenever a traitor tries to knife someone everyone disconnects because of lua errors. When I looked in console i found the following errors.

[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:66: attempt to call global 'ValidEntity' (a nil value)
  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:66

Disconnect: "Too many Lua Errors! Sorry!".
Disconnect: "Too many Lua Errors! Sorry!".

[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:267: attempt to call global 'ValidEntity' (a nil value)
  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:267

My server’s knife shared.lua file is at http://pastebin.com/z7Lvw2Ry The only way it is different from the default file is that the damage for the knife is 100.

How do I fix this so people don’t disconnect whenever someone is stabbed?

When gmod updated to 13 ValidEntity changed to IsValid

I changed all of the ValidEntitys to IsValid and everyone disconnected when they joined instead of disconnecting when someone got stabbed. Everyone got the following error message

[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:2: '=' expected near 'if'
  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_knife/shared.lua:0

on line 2 your saying something like

if this = that then
 do this

instead of

if this==that then
 do this

P.s. do that ^

[editline]17th February 2013[/editline]

I would also suggest next time you put this in the lua support thread

So i putt

if SERVER and IsValid then
   AddCSLuaFile( "shared.lua" )

? I’m new to lua coding.

Line 66:
if !IsValid(tr.Entity) then
tr = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner, mask=MASK_SHOT_HULL})

Line 267:
if CLIENT && IsValid(self.Owner) && self.Owner == LocalPlayer() && self.Owner:Alive() then
You should learn to use Lua operators. Here is a wiki link: **[Lua/Specific_Operators

[editline]17th February 2013[/editline]
Quick off topic question you don’t need to answer: Why a 1-hit knife?

I don’t see the operators Pandaman09 is refering to. Do I use them like

if SERVER == IsValid then
   AddCSLuaFile( "shared.lua" )

or should I keep it the same as it is in the shared.lua file but change the ValidEntity to IsValid?

People like it. Everyone sounds disappointed if it’s not a 1-hit knife, plus I don’t have a problem with it.

== means “is equal to”
IsValid checks to see if the thing (entity) exists

So it goes

is equal to SERVER then
   AddCSLuaFile( "shared.lua" )



If you just want to add the file serverside which it looks like you’re trying to do: [lua]
if SERVER then

No offence, but if you can’t understand simple Lua code, I don’t think you should be touching a simple variable edit just yet.

It was either edit the knife or remove it. The knife is fixed. I’d like to thank everyone for their help. I don’t know what I would of done without you guys. thx