What's wrong with this timer..

Hey, does anybody know what there is wrong with this timer:


timer.Simple( 0.3, function(wep) if wep:IsValid() then wep:SetWeaponHoldType("normal") end end, self) end )

Thanks.

It should be like this:
Without self and the third end.

[lua]timer.Simple( 0.3, function(wep)
if wep:IsValid() then
wep:SetWeaponHoldType(“normal”)
end
end )[/lua]
This should work


timer.Simple( 0.3, function()
   if wep:IsValid() then 
      wep:SetWeaponHoldType("normal") 
   end
end )

Format your code properly and you’ll see your errors.

I get this error:


[ERROR] addons/taserv1.3-final/lua/weapons/weapon_taser/shared.lua:69: attempt to index global 'wep' (a nil value)
  1. unknown - addons/taserv1.3-final/lua/weapons/weapon_taser/shared.lua:69

Timer Failed! [Simple][@addons/taserv1.3-final/lua/weapons/weapon_taser/shared.lua (line 68)]
[

Well you might want to replace wep with whatever you are using in your code. I believe it’s self.