attempt to index global 'hook' <a nil value>

C:\Documents and Settings*****\Desktop\Dedicated server\Gameserver\orangebox\garrysmod\gamemodes\WW2\gamemode–init.lua

I recently started making a gamemode base off of WWII and have come across this error while shifting the gamemode from one server to the other. I haven’t touched the gamemode in any way while moving it before and after.

Here is what its snapping at, it comes up with the error in the title on line 285 my health regeneration.

Sorry but the BBcode isnt working properly for me.

function EntityTakeDamage( ent )
if ( ent:IsPlayer() ) then
ent.Regen = CurTime() + 5
end
end
hook.Add(“EntityTakeDamage”, “WW2_EntityTakeDamage”, EntityTakeDamage)

local RegenTime = 0
local function Regen()
local CT = CurTime()
if RegenTime < CT then
RegenTime = CT + 1
for _, ply in pairs(player.GetAll()) do
if ply:Alive() and (ply.Regen or 0) < CT and ply:Health() < 100 then
ply:SetHealth(ply:Health() + 1)
end
end
end
end
hook.Add(“Think”, “WW2_Regen”, Regen)

please post the full error so we can see what line you got the error on
[lua]
function EntityTakeDamage( ent )
if ( ent:IsPlayer() ) then
ent.Regen = CurTime() + 5
end
end
hook.Add(“EntityTakeDamage”, “WW2_EntityTakeDamage”, EntityTakeDamage)

local RegenTime = 0
local function Regen()
local CT = CurTime()
if RegenTime < CT then
RegenTime = CT + 1
for _, ply in pairs(player.GetAll()) do
if ply:Alive() and (ply.Regen or 0) < CT and ply:Health() < 100 then
ply:SetHealth(ply:Health() + 1)
end
end
end
end
hook.Add(“Think”, “WW2_Regen”, Regen)
[/lua]

1> use lua tags, [lua] or



2&gt; the regen code is from jailbreak
3&gt; as far as i see, the hook function is missing, try to make it work on an timer, delay it some?
4&gt; code whit tabs, it hurts less on your eyes when looking truw mayor script:P