Got a error on time
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Got a error on time

Started by Themaster, 30 December, 2004, 12:48:02

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Themaster

Hello ppl

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

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
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

[_XStaTiC_]

try this :)
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

Optimus

yups i think that should do it

Themaster

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

Themaster

I Still got the bug on my time function i do have try many thing .....plz help now i'm so sad now

Error
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
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

[_XStaTiC_]

try this :)

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

Themaster

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

SMF spam blocked by CleanTalk