ULX

Author Topic: Timer issue  (Read 3872 times)

0 Members and 1 Guest are viewing this topic.

Offline Digital Spit

  • Jr. Member
  • **
  • Posts: 79
  • Karma: 1
Timer issue
« on: June 26, 2014, 02:38:23 AM »
I'm working on a little script that'll change the job of a player after a given time, but for some reason I can't get the timer to work, what am I doing wrong? I've tried moving it all to one line and I've also tried rewriting the timer, but alas no result :/

Code: [Select]
local Players = player.GetAll()
for i = 1, table.Count(Players) do
local ply = Players[i]
if (ply:Team() == TEAM_DEFAULTED ) then
timer.Create("randomJob", 180, 1,
ply:changeTeam( job_table[randomJob], true),
ply:PrintMessage(HUD_PRINTCENTER, "Your job has been auto-selected")
end)
end

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Timer issue
« Reply #1 on: June 26, 2014, 05:49:30 AM »
Timers have unique ids like hooks. If two are the same they will overwrite.

Offline Digital Spit

  • Jr. Member
  • **
  • Posts: 79
  • Karma: 1
Re: Timer issue
« Reply #2 on: June 26, 2014, 11:28:33 AM »
I've changed the ID of the timer, but that give the same error...any other suggestions?  :)

Code: [Select]
[ERROR] lua/money.lua:55: ')' expected (to close '(' at line 52) near 'end'
  1. unknown - lua/money.lua:0

That's the error I keep getting and I'm not sure why. All of the parenthesis close out perfectly, what am I missing?

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given