Timer won't work!

Hey guys, i am trying to fix the Suicide Bomb for TTT.
I got on every use after 20 seconds (timer) two errors.

Errors:
blue error:
[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/shared.lua
:173: ‘(’ expected near ‘AutoDetonate’

  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/sha
    red.lua:0

and
yellow error:
[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/shared.lua
:173: ‘(’ expected near ‘AutoDetonate’

  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/sha
    red.lua:0



function with timer:


if SERVER then
function TTTSuicideDone(ply, cmd, args)
local idx = tonumber(args[1])
local self = ents.GetByIndex(idx)
if self:IsValid() then
if self.arming == true and self.AllowDrop == false then
self.loopingSound:Stop()
self.armedandready = true
self.arming = false
self.Owner:PrintMessage(4,“You Only Have 20 Seconds Until You Auto Detonate…”)
timer.Create(“autodetonate”, 20, 1, Autodetonate, self)
end
end
end
concommand.Add(“ttt_suicidebomb-done”, TTTSuicideDone)
end




AutoDetonate function:


function AutoDetonate(self)
self.Owner.SetColor(self.Owner ,255, 255, 255, 255) – Colour again
ownr = self.Owner
umsg.Start(“SuicideBombBar”, ownr);
umsg.Bool(false);
umsg.End();
self.DetonateBomb(self)
end




Help me pls

[editline]25th January 2014[/editline]

wtf, now i get this error


[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/shared.lua
:173: bad argument #4 to ‘Create’ (function expected, got nil)

  1. Create - [C]:-1
  2. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/sh
    ared.lua:173
    3. unknown - lua/includes/modules/concommand.lua:69

It doesn’t take varargs. Create a call back function and use upvalues instead.

How? :smiley:

-snip-


timer.Create("autodetonate", 20, 1,function() Autodetonate(self) end)

Error still appears!

What errors? Post the new errors and current code you have. Don’t forget to indicate what line causes the error in the code.


[ERROR] gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/shared.lua
:173: attempt to call global 'Autodetonate' (a nil value)
  1. unknown - gamemodes/terrortown/entities/weapons/weapon_ttt_suicide_bomb/sha
red.lua:173

Timer Failed! [autodetonate][@gamemodes/terrortown/entities/weapons/weapon_ttt_s
uicide_bomb/shared.lua (line 173)]

Just do this:[lua]timer.Create(“autodetonate”, 20, 1,function()
self.Owner:SetColor(Color(255,255,255)) – Colour again
umsg.Start(“SuicideBombBar”, self.Owner)
umsg.Bool(false)
umsg.End();
self:DetonateBomb()
end)[/lua]

Oh god, your code is all sorts of messed up, go learn Lua before your try coding something.

Thank you!
It works now.
+
This isn’t my script, i tried only to convert it.