• Whitelist timing system errors
    14 replies, posted
Hello, I am trying to make a script which allows players to trial a server for a certain period and then bans them awaiting a whitelist application after they have had chance to try out the server and to find out if they can be bothered to apply. I have the follow code: [code] timer.Create( playtimeCheck, 60, 0, ongoingCheck ) local function ongoingCheck() for k, v in pairs( player.GetAll() ) do If v:GetUTimeTotalTime() = 3600 then ULib.ban(v, 0, "Apply for whitelisted status at website") else print("You can play for a while longer before having to be whitelisted") end end end [/code] But it throws the error: [code] [ERROR] lua/autorun/server/whitelist.lua:5: '=' expected near 'v'   1. unknown - lua/autorun/server/whitelist.lua:0 [/code] Any help with this would be appreciated, I cannot understand why an '=' would be needed here. Thanks!
[code] [/code] Yea...thats no how it works m8. Theres a extra code tag at the bottom of the text editor
Already sorted it.
If if
Just corrected this, still getting the same error. Thanks for the input though.
v:GetUTimeTotalTime() = 3600 then v:GetUTimeTotalTime() == 3600 then
Yeh, like I said in OP, the forum messed up my spacing.
I tried that and I got the following error [ERROR] lua/autorun/server/whitelist.lua:1: bad argument #4 to 'Create' (function expected, got nil)   1. Create - [C]:-1    2. unknown - lua/autorun/server/whitelist.lua:1
You're calling timer.Create before defining the function. Also you should check if it's greater than or equal to considering you're only checking this every 60 seconds.
Thanks for the reply! That was an obvious error thanks for pointing it out! I've got this code now: local function ongoingCheck() for k, v in pairs( player.GetAll() ) do if v:GetUTimeTotalTime() >= 3600 then ULib.ban(v, 0, "Apply for whitelisted status at website") else print("You can play for a while longer before having to be whitelisted") end end end timer.Create( playtimeCheck, 60, 0, ongoingCheck ) Still getting this error though: [ERROR] lua/autorun/server/whitelist.lua:11: bad argument #1 to 'Create' (string expected, got nil)   1. Create - [C]:-1    2. unknown - lua/autorun/server/whitelist.lua:11
timer.Create takes a string as the first argument, you're passing it a variable, an undefined one at that.
That fixed it! Thanks a lot, I should really have spotted that!
you still would have got an error for If v:GetUTimeTotalTime() = 3600
He fixed that - read his latest code revision.
local function ongoingCheck() for k, v inpairs( player.GetAll() ) do if v:GetUTimeTotalTime() >= 3600 then ULib.ban(v, 0, "Apply for whitelisted status at website") else print("You can play for a while longer before having to be whitelisted") end end end timer.Create( "playtimeCheck", 60, 0, ongoingCheck )
Sorry, you need to Log In to post a reply to this thread.