• Time Arithmetic error
    2 replies, posted
[CODE]function AddDonator(steamid, time, ply) if !IsValid(ply) then return end if !time then return end >> time = tonumber(time) >> time = time * 60 * 60 >> time = os.time() + tonumber(time) mysql.query("INSERT INTO donator (steamid, time) VALUES ('"..steamid.."', '"..tostring(math.Round(time)).."') ") DB.Donator[steamid] = {["time"] = time} ply:SendLua("chat.AddText(Color(255,0,0,255), 'Der Spieler mit der SteamID:"..steamid.." hat nun fuer "..time.." seinen Donatorstatus!')") end local function AddDonatorz(ply, cmds, args) if !ply or !IsValid(ply) then return end if !args[1] or !args[2] then return end AddDonator(args[1], args[2], ply) end concommand.Add("AddDonator", AddDonatorz)[/CODE] ] [CODE] [ERROR] lua/autorun/server/myqlconnect.lua:102: attempt to perform arithmetic on local 'time' (a string value) 1. AddDonator - lua/autorun/server/myqlconnect.lua:102 2. unknown - lua/autorun/server/myqlconnect.lua:118 3. unknown - lua/includes/modules/concommand.lua:69[/CODE] and im using this [url]http://facepunch.com/showthread.php?t=1220537[/url] i get some lua errors about try to perform arithmetic time (a nil value) i dont know how to fix it its marked with >>
First, I would post in the Lua section, since this is lua. Second, We need the exact error so that we know what's wrong. Also, what mysql module are you using? [editline]26th February 2013[/editline] Is time a string? Your not checking to see if time is valid before multiplying it.
ok i updated
Sorry, you need to Log In to post a reply to this thread.