Author Topic: Got a error on time  (Read 2430 times)

0 Members and 1 Guest are viewing this topic.

Offline Themaster

  • Triple Ace
  • **
  • Posts: 204
  • Karma: +0/-0
Got a error on time
« on: 30 December, 2004, 12:48:02 »
Hello ppl

I just got this HubTime-V.1.63.lua script...and i got a error on 1 thin

Code: [Select]
elseif cmd == "+myhubtime" then
local tmp = UserHubTime[user.sName]
local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
user:SendData(Bot, "You have been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")
return 1

the error
Code: [Select]
Syntax error: attempt to perform arithmetic on local `tmp' (a nil value)
stack traceback:
   1:  function `UserCommands' at line 237 [file `...ettings\scripts\Blade1.5.lua']
   2:  function `DataArrival' at line 91 [file `...ettings\scripts\Blade1.5.lua']


i can't get it right...the other 2 function's work ass it shoot
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

PtokaX forum

Got a error on time
« on: 30 December, 2004, 12:48:02 »

Offline [_XStaTiC_]

  • Fulll Member
  • ****
  • Posts: 51
  • Karma: +0/-0
(No subject)
« Reply #1 on: 30 December, 2004, 13:12:34 »
try this :)
Code: [Select]
elseif cmd == "+myhubtime" then
local tmp = UserHubTime[user.sName]
                        if tmp then
local months, days, hours, minutes = floor(tmp/43200), floor(mod(tmp/1440, 30)), floor(mod(tmp/60, 24)), floor(mod(tmp/1, 60))
user:SendData(Bot, "You have been online : "..months.." months, "..days.." days, "..hours.." hours, "..minutes.." minutes ( "..tmp.." min ). That is "..format("%.2f",tmp/UserHubTime["HubUpTime"]*100).." % of the total HubUpTime.")          
                        end
return 1

Offline Optimus

  • Emperor
  • **
  • Posts: 1 474
  • Karma: +13/-1
(No subject)
« Reply #2 on: 30 December, 2004, 13:42:05 »
yups i think that should do it

Offline Themaster

  • Triple Ace
  • **
  • Posts: 204
  • Karma: +0/-0
(No subject)
« Reply #3 on: 30 December, 2004, 16:40:12 »
thx...that work :)
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Offline Themaster

  • Triple Ace
  • **
  • Posts: 204
  • Karma: +0/-0
(No subject)
« Reply #4 on: 31 December, 2004, 00:20:15 »
I Still got the bug on my time function i do have try many thing .....plz help now i'm so sad now

Error
Code: [Select]
Syntax error: bad argument #1 to `write' (string expected, got nil)
stack traceback:
   1:  function `write' [C]
   2:  function `WriteFile' at line 478 [file `...s\den lille\Blade1.5.lua']
   3:  function `OnTimer' at line 47 [file `...s\den lille\Blade1.5.lua']

Script
Code: [Select]
function WriteFile(table, tablename, file)
local handle = openfile("txt/"..file, "w")
write(handle, tablename.." = {\n" )
for key, value in table do
if value >= Max2 then
[COLOR=red]write(handle, "\t"..format("[%q]",key).." = "..value..",\n")[/COLOR] end
end
write(handle, "}");
  closefile(handle)
end

and

function OnTimer()
for i,v in UserHubTime do
if GetItemByName(i) or i=="HubUpTime" then
v=v+1
UserHubTime[i]=v
end
end
var1 = var1 + 1
if var1 == Max1 then
[COLOR=red]WriteFile(UserHubTime, "UserHubTime", File1)[/COLOR]
var1 = 0
end
   clear()
end
and also that function here i got
File1 = "Blade/txt/UserHubTime.txt"
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

Offline [_XStaTiC_]

  • Fulll Member
  • ****
  • Posts: 51
  • Karma: +0/-0
(No subject)
« Reply #5 on: 31 December, 2004, 01:39:48 »
try this :)

Code: [Select]
function WriteFile(table, tablename, file)
local handle = openfile(file, "w")
write(handle, tablename.." = {\n" )
for key, value in table do
if value >= Max2 then
write(handle, "\t"..format("[%q]",key).." = "..value..",\n")
end
end
write(handle, "}");
  closefile(handle)
end

Offline Themaster

  • Triple Ace
  • **
  • Posts: 204
  • Karma: +0/-0
(No subject)
« Reply #6 on: 31 December, 2004, 10:54:40 »
Thx again...It just work ass it shoot....

And HAPPY NEW YEAR !!!!!!!!!!!!

PARTY ON !!!!!!!!
peace out...and love to your all scripter..that do the hard work  :D And all thx to your all there are here 2 help!!! :]

blade.lir.dk

PtokaX forum

(No subject)
« Reply #6 on: 31 December, 2004, 10:54:40 »