Covert Exchange
 

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

Covert Exchange

Started by c h i l l a, 26 November, 2003, 10:35:54

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

c h i l l a

okey that's my ides of a exchange converter bot,
I also must say the VB one in the Request scripts, was written by Kotten.

well here is mine...

--Exchange-Converter V.1 written by chill
--Based on an idea from Kotten

bot1 = "Converter"

EPrefix = "%!%+%-%?"

MainCurrency = "EUR"

cmd1 = "changehelp"
cmd2 = "change"
cmd3 = "converthelp"
cmd4 = "convert"

--10 USD to EUR = 10/USD-EUR == EUR

GETHTML = "GET /d/EUR/table.html HTTP/1.1\r\nHost: www.x-rates.com\r\nUser-Agent: Mozilla/4.0 (compatible; LUA 4.0; LUA 4.0)\r\n"

Converters = {
["?F-?C"] = "([x]-32)*5/9",
["?C-?F"] = "[x]*5/9+32",
["IN-CM"] = "[x]*2.54",
["CM-IN"] = "[x]/2.54",
["FT-CM"] = "[x]*2.54*12",
["CM-FT"] = "[x]/(2.54*12)",
["MI-CM"] = "[x]*1.6093*1000*100",
["CM-MI"] = "[x]/(1.6093*1000*100)",
["KM-CM"] = "[x]*1000*100",
["CM-KM"] = "[x]/(1000*100)",
["M-CM"] = "[x]*100",
["CM-M"] = "[x]/100",
["LBS-KG"] = "[x]*0.4536",
["KG-LBS"] = "[x]/0.4536",
}

convhelp = "\tMiles = MI\r\n"..
"\tFoot = FT\r\n"..
"\tInch = IN\r\n"..
"\tCentimeter = CM\r\n"..
"\tMeter = M\r\n"..
"\tKilometer = KM\r\n"..
"\tPound = LBS\r\n"..
"\tKilogramms = KG\r\n"..
"\tFahrenheit = ?F\r\n"..
"\tCelsius = ?C\r\n"

FindRates = {
{ "American Dollar ","USD" },
{ "Australian Dollar ","AUD" },
{ "Botswana Pula ","BWP" },
{ "Brazilian Real ","BRL" },
{ "British Pound ","GBP" },
{ "Canadian Dollar ","CAD" },
{ "Chinese Yuan ","CNY" },
{ "Danish Krone ","DKK" },
{ "Hong Kong Dollar ","HKD" },
{ "Hungarian Forint ","HUF" },
{ "Indian Rupee ","INR" },
{ "Japanese Yen ","JPY" },
{ "Malaysian Ringgit ","MYR" },
{ "Mexican Peso ","MXN" },
{ "New Zealand Dollar ","NZD" },
{ "Norwegian Kroner ","NOK" },
{ "Singapore Dollar ","SGD" },
{ "South African Rand ","ZAR" },
{ "South Korean Won ","KRW" },
{ "Sri Lanka Rupee ","LKR" },
{ "Swedish Krona ","SEK" },
{ "Swiss Franc ","CHF" },
{ "Taiwan Dollar ","TWD" },
{ "Thai Baht ","THB" },
{ "Venezuelan Bolivar ","VEB" },
}

curday = 0

curRates = {}

dofile("txt/curRates.txt")

hour = 1000*60*60

function Main()
	SetTimer(hour) 
	StartTimer()
	local var = 0
	for i,_ in curRates do
		var = var + 1
		if var == 1 then
			break
		end
	end
	if var == 0 then
		GetRates()
	end
end

function DataArrival(curUser,data)
	if (strsub(data,1,1) == "<") then 
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s["..EPrefix.."](%S+)" )

		if not cmd then
			return 0
		end
		
		if (strlower(cmd) == strlower(cmd1)) then
			local curhelp = ""
			for i,_ in FindRates do
				curhelp = curhelp.."\tCurrency:    "..strsub(FindRates[i][1],1,strlen(FindRates[i][1])-5).."     Shorten:     "..FindRates[i][2].."\r\n"
			end
			curUser:SendData(bot1,"Prefixa = + - ! ?\r\n\r\n"..
			"\tSyntax: \""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency]\r\n\r\n"..
			"\tAvailable Currencies =\r\n\r\n"..curhelp)
			return 1

		elseif (strlower(cmd) == strlower(cmd2)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				if curRates[str2.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/curRates[str2.."-"..str3])
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				elseif tonumber(str1) and curRates[str2.."-"..MainCurrency] and curRates[MainCurrency.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/(curRates[str2.."-"..MainCurrency]*curRates[MainCurrency.."-"..str3]))
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency], Prefixa = + - ! ?")
			end
			return 1

		elseif (strlower(cmd) == strlower(cmd3)) then
			curUser:SendData(bot1,"Syntax: Prefixa \""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?\r\n\r\n"..convhelp)

		elseif (strlower(cmd) == strlower(cmd4)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				conv = ""
				if Converters[str2.."-"..str3] then
					local x = gsub(Converters[str2.."-"..str3],"%b[]",str1)
					dostring("conv="..x)
					curUser:SendData(bot1,str1.." "..str2.." = "..conv.." "..str3)
				elseif tonumber(str1) and Converters[str2.."-CM"] and Converters["CM-"..str3] then
					local x1 = gsub(Converters[str2.."-CM"],"%b[]",str1)
					dostring("conv="..x1)
					local x2 = gsub(Converters["CM-"..str3],"%b[]",conv)
					dostring("conv="..x2)
					curUser:SendData(bot1,str1.." "..str2.." = "..conv.." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?")
			end
			return 1
		end
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function OnTimer()
	if tonumber(date("%d")) ~= curday then
		curday = tonumber(date("%d"))
		GetRates()
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function WriteFile(table,tablename,file)
	local handle = openfile("txt/"..file,"w")
	Serialize(table,tablename,handle)
	if table == curRates then
		write(handle,"\r\ncurday = "..curday)
	end
  	closefile(handle)
end
----------------------------------------------------------------------------------------------------------------------------------------------
function Serialize(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	write(hFile,sTab..sTableName.." = {\n");
	for key,value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value,sKey,hFile,sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			write(hFile,sTab.."\t"..sKey.." = "..sValue);
		end
		write(hFile,",\n");
	end
	write(hFile,sTab.."}");
end
----------------------------------------------------------------------------------------------------------------------------------------------
function GetRates()
	curRates = {}
	socket, e = connect("www.x-rates.com", 80)
	if not e then
		local line = ""
		socket:timeout(2)
		socket:send(GETHTML..strchar(13,10))
		while not e do
			line1,e = socket:receive("*l")
			foreachi(FindRates, function(a,b)
				if strfind(line1, b[1]) then 
					for i = 1,2 do 
						line2,e = socket:receive("*l")
						local _,_,num = strfind(line2,">(%S+)")
						if i == 1 and tonumber(num) then
							curRates[b[2].."-"..MainCurrency] = tonumber(num)
						elseif i == 2 and tonumber(num) then
							curRates[MainCurrency.."-"..b[2]] = tonumber(num)
						end
					end
				end
			end)
		end
		socket:close()
		WriteFile(curRates,"curRates","curRates.txt")
	end
end

BlazeXxX

WoW Niceee ! I surely wanted something for my hub ages ago :) Thanks mate for the wonderful script :D

c h i l l a

no prob BlazeXxX :)

this one looks nicer.

--Exchange-Converter V.1 written by chill
--Based on an idea from Kotten
--You need a "txt" folder, "scripts/txt"

bot1 = "Converter"

EPrefix = "%!%+%-%?"

MainCurrency = "EUR"

cmd1 = "changehelp"
cmd2 = "change"
cmd3 = "converthelp"
cmd4 = "convert"

--10 USD to EUR = 10/USD-EUR == EUR

GETHTML = "GET /d/EUR/table.html HTTP/1.1\r\nHost: [URL]www.x-rates.com\r\nUser-Agent:[/URL] Mozilla/4.0 (compatible; LUA 4.0; LUA 4.0)\r\n"

Converters = {
["?F-?C"] = "([x]-32)*5/9",
["?C-?F"] = "[x]*5/9+32",
["IN-CM"] = "[x]*2.54",
["CM-IN"] = "[x]/2.54",
["FT-CM"] = "[x]*2.54*12",
["CM-FT"] = "[x]/(2.54*12)",
["MI-CM"] = "[x]*1.6093*1000*100",
["CM-MI"] = "[x]/(1.6093*1000*100)",
["KM-CM"] = "[x]*1000*100",
["CM-KM"] = "[x]/(1000*100)",
["M-CM"] = "[x]*100",
["CM-M"] = "[x]/100",
["LBS-KG"] = "[x]*0.4536",
["KG-LBS"] = "[x]/0.4536",
}

convhelp = "\tMiles = MI\r\n"..
"\tFoot = FT\r\n"..
"\tInch = IN\r\n"..
"\tCentimeter = CM\r\n"..
"\tMeter = M\r\n"..
"\tKilometer = KM\r\n"..
"\tPound = LBS\r\n"..
"\tKilogramms = KG\r\n"..
"\tFahrenheit = ?F\r\n"..
"\tCelsius = ?C\r\n"

FindRates = {
{ "American Dollar ","USD" },
{ "Australian Dollar ","AUD" },
{ "Botswana Pula ","BWP" },
{ "Brazilian Real ","BRL" },
{ "British Pound ","GBP" },
{ "Canadian Dollar ","CAD" },
{ "Chinese Yuan ","CNY" },
{ "Danish Krone ","DKK" },
{ "Hong Kong Dollar ","HKD" },
{ "Hungarian Forint ","HUF" },
{ "Indian Rupee ","INR" },
{ "Japanese Yen ","JPY" },
{ "Malaysian Ringgit ","MYR" },
{ "Mexican Peso ","MXN" },
{ "New Zealand Dollar ","NZD" },
{ "Norwegian Kroner ","NOK" },
{ "Singapore Dollar ","SGD" },
{ "South African Rand ","ZAR" },
{ "South Korean Won ","KRW" },
{ "Sri Lanka Rupee ","LKR" },
{ "Swedish Krona ","SEK" },
{ "Swiss Franc ","CHF" },
{ "Taiwan Dollar ","TWD" },
{ "Thai Baht ","THB" },
{ "Venezuelan Bolivar ","VEB" },
}

curday = 0

curRates = { ["n"] = 0, }

dofile("txt/curRates.txt")

hour = 1000*60*60

function Main()
	SetTimer(hour) 
	StartTimer()
	local var = 0
	if getn(curRates) == 0 then
		GetRates()
	end
	curhelp = ""
	for i,_ in FindRates do
		curhelp = curhelp.."\tCurrency:    "..strsub(FindRates[i][1],1,strlen(FindRates[i][1])-5).."     Shorten:     "..FindRates[i][2].."\r\n"
	end
end

function DataArrival(curUser,data)
	if (strsub(data,1,1) == "<") then 
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s["..EPrefix.."](%S+)" )

		if not cmd then
			return 0
		end
		
		if (strlower(cmd) == strlower(cmd1)) then
			curUser:SendData(bot1,"Prefixa = + - ! ?\r\n\r\n"..
			"\tSyntax: \""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency]\r\n\r\n"..
			"\tAvailable Currencies =\r\n\r\n"..curhelp)
			return 1

		elseif (strlower(cmd) == strlower(cmd2)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				if curRates[str2.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/curRates[str2.."-"..str3])
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				elseif tonumber(str1) and curRates[str2.."-"..MainCurrency] and curRates[MainCurrency.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/(curRates[str2.."-"..MainCurrency]*curRates[MainCurrency.."-"..str3]))
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency], Prefixa = + - ! ?")
			end
			return 1

		elseif (strlower(cmd) == strlower(cmd3)) then
			curUser:SendData(bot1,"Syntax: Prefixa \""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?\r\n\r\n"..convhelp)

		elseif (strlower(cmd) == strlower(cmd4)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				conv = ""
				if Converters[str2.."-"..str3] then
					local x = gsub(Converters[str2.."-"..str3],"%b[]",str1)
					dostring("conv="..x)
					curUser:SendData(bot1,str1.." "..str2.." = "..format("%0.2f",conv).." "..str3)
				elseif tonumber(str1) and Converters[str2.."-CM"] and Converters["CM-"..str3] then
					local x1 = gsub(Converters[str2.."-CM"],"%b[]",str1)
					dostring("conv="..x1)
					local x2 = gsub(Converters["CM-"..str3],"%b[]",conv)
					dostring("conv="..x2)
					curUser:SendData(bot1,str1.." "..str2.." = "..format("%0.2f",conv).." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?")
			end
			return 1
		end
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function OnTimer()
	if tonumber(date("%d")) ~= curday then
		GetRates()
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function WriteFile(table,tablename,file)
	local handle = openfile("txt/"..file,"w")
	Serialize(table,tablename,handle)
	if table == curRates then
		write(handle,"\r\ncurday = "..curday)
	end
  	closefile(handle)
end
----------------------------------------------------------------------------------------------------------------------------------------------
function Serialize(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	write(hFile,sTab..sTableName.." = {\n");
	for key,value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value,sKey,hFile,sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			write(hFile,sTab.."\t"..sKey.." = "..sValue);
		end
		write(hFile,",\n");
	end
	write(hFile,sTab.."}");
end
----------------------------------------------------------------------------------------------------------------------------------------------
function GetRates()
	curRates = {}
	socket, e = connect("www.x-rates.com", 80)
	if not e then
		socket:timeout(2)
		socket:send(GETHTML..strchar(13,10))
		while not e do
			line1,e = socket:receive("*l")
			foreachi(FindRates, function(a,b)
				if strfind(line1, b[1]) then 
					for i = 1,2 do 
						line2,e = socket:receive("*l")
						local _,_,num = strfind(line2,">(%S+)")
						if i == 1 and tonumber(num) then
							curRates[b[2].."-"..MainCurrency] = tonumber(num)
						elseif i == 2 and tonumber(num) then
							curRates[MainCurrency.."-"..b[2]] = tonumber(num)
						end
					end
				end
			end)
		end
		socket:close()
		curday = tonumber(date("%d"))
		WriteFile(curRates,"curRates","curRates.txt")
	end
end

pHaTTy

LOOOOOOOOOOOOOL WOW THAT IT COOOOOOOOL

i was gonna do a bot that done that alng time ago but i cud never get it to work, and it werent nothink like this heh this is GREAT!!!!


well done dude :))
Resistance is futile!

c h i l l a

thanks a lot, mate...   :))  my little thanksgiving script, hehe

c h i l l a

okey...  just a fix
final of this version then
--Exchange-Converter V.1 written by chill
--Based on an idea from Kotten
--You need a "txt" folder, "scripts/txt"

bot1 = "Converter"

EPrefix = "%!%+%-%?"

MainCurrency = "EUR"

cmd1 = "changehelp"
cmd2 = "change"
cmd3 = "converthelp"
cmd4 = "convert"

--10 USD to EUR = 10/USD-EUR == EUR

GETHTML = "GET /d/EUR/table.html HTTP/1.1\r\nHost: [URL]www.x-rates.com\r\nUser-Agent:[/URL] Mozilla/4.0 (compatible; LUA 4.0; LUA 4.0)\r\n"

Converters = {
["?F-?C"] = "([x]-32)*5/9",
["?C-?F"] = "[x]*5/9+32",
["IN-CM"] = "[x]*2.54",
["CM-IN"] = "[x]/2.54",
["FT-CM"] = "[x]*2.54*12",
["CM-FT"] = "[x]/(2.54*12)",
["MI-CM"] = "[x]*1.6093*1000*100",
["CM-MI"] = "[x]/(1.6093*1000*100)",
["KM-CM"] = "[x]*1000*100",
["CM-KM"] = "[x]/(1000*100)",
["M-CM"] = "[x]*100",
["CM-M"] = "[x]/100",
["LBS-KG"] = "[x]*0.4536",
["KG-LBS"] = "[x]/0.4536",
}

convhelp = "\tMiles = MI\r\n"..
"\tFoot = FT\r\n"..
"\tInch = IN\r\n"..
"\tCentimeter = CM\r\n"..
"\tMeter = M\r\n"..
"\tKilometer = KM\r\n"..
"\tPound = LBS\r\n"..
"\tKilogramms = KG\r\n"..
"\tFahrenheit = ?F\r\n"..
"\tCelsius = ?C\r\n"

FindRates = {
{ "American Dollar ","USD" },
{ "Australian Dollar ","AUD" },
{ "Botswana Pula ","BWP" },
{ "Brazilian Real ","BRL" },
{ "British Pound ","GBP" },
{ "Canadian Dollar ","CAD" },
{ "Chinese Yuan ","CNY" },
{ "Danish Krone ","DKK" },
{ "Hong Kong Dollar ","HKD" },
{ "Hungarian Forint ","HUF" },
{ "Indian Rupee ","INR" },
{ "Japanese Yen ","JPY" },
{ "Malaysian Ringgit ","MYR" },
{ "Mexican Peso ","MXN" },
{ "New Zealand Dollar ","NZD" },
{ "Norwegian Kroner ","NOK" },
{ "Singapore Dollar ","SGD" },
{ "South African Rand ","ZAR" },
{ "South Korean Won ","KRW" },
{ "Sri Lanka Rupee ","LKR" },
{ "Swedish Krona ","SEK" },
{ "Swiss Franc ","CHF" },
{ "Taiwan Dollar ","TWD" },
{ "Thai Baht ","THB" },
{ "Venezuelan Bolivar ","VEB" },
}

curday = 0

curRates = { ["n"] = 0, }

dofile("txt/curRates.txt")

hour = 1000*60*60

function Main()
	SetTimer(hour) 
	StartTimer()
	local var = 0
	if curRates.n ~= 1 then
		GetRates()
	end
	curhelp = ""
	for i,_ in FindRates do
		curhelp = curhelp.."\tCurrency:    "..strsub(FindRates[i][1],1,strlen(FindRates[i][1])-5).."     Shorten:     "..FindRates[i][2].."\r\n"
	end
end

function DataArrival(curUser,data)
	if (strsub(data,1,1) == "<") then 
		data = strsub(data,1,strlen(data)-1)
		local _,_,cmd = strfind( data, "%b<>%s["..EPrefix.."](%S+)" )

		if not cmd then
			return 0
		end
		
		if (strlower(cmd) == strlower(cmd1)) then
			curUser:SendData(bot1,"Syntax: Prefix\""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency], Prefixa = + - ! ?\r\n\r\n"..
			"\tAvailable Currencies =\r\n\r\n"..curhelp)
			return 1

		elseif (strlower(cmd) == strlower(cmd2)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				if curRates[str2.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/curRates[str2.."-"..str3])
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				elseif tonumber(str1) and curRates[str2.."-"..MainCurrency] and curRates[MainCurrency.."-"..str3] then
					local change = format("%0.2f",tonumber(str1)/(curRates[str2.."-"..MainCurrency]*curRates[MainCurrency.."-"..str3]))
					curUser:SendData(bot1,str1.." "..str2.." = "..change.." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd2.."\" [Amount] [CurrentCurrency] [WantedCurrrency], Prefixa = + - ! ?")
			end
			return 1

		elseif (strlower(cmd) == strlower(cmd3)) then
			curUser:SendData(bot1,"Syntax: Prefix\""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?\r\n\r\n"..convhelp)

		elseif (strlower(cmd) == strlower(cmd4)) then
			local _,_,str1,str2,str3 = strfind(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)%s+(%S+)")
			if tonumber(str1) then
				str2, str3 = strupper(str2),strupper(str3)
				conv = ""
				if Converters[str2.."-"..str3] then
					local x = gsub(Converters[str2.."-"..str3],"%b[]",str1)
					dostring("conv="..x)
					curUser:SendData(bot1,str1.." "..str2.." = "..format("%0.2f",conv).." "..str3)
				elseif tonumber(str1) and Converters[str2.."-CM"] and Converters["CM-"..str3] then
					local x1 = gsub(Converters[str2.."-CM"],"%b[]",str1)
					dostring("conv="..x1)
					local x2 = gsub(Converters["CM-"..str3],"%b[]",conv)
					dostring("conv="..x2)
					curUser:SendData(bot1,str1.." "..str2.." = "..format("%0.2f",conv).." "..str3)
				end
			else
				curUser:SendData(bot1,"Syntax: Prefixa \""..cmd4.."\" [Number] [CurrentValue] [WantedValue], Prefixa = + - ! ?")
			end
			return 1
		end
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function OnTimer()
	if tonumber(date("%d")) ~= curday then
		GetRates()
	end
end
----------------------------------------------------------------------------------------------------------------------------------------------
function WriteFile(table,tablename,file)
	local handle = openfile("txt/"..file,"w")
	Serialize(table,tablename,handle)
	if table == curRates then
		write(handle,"\r\ncurday = "..curday)
	end
  	closefile(handle)
end
----------------------------------------------------------------------------------------------------------------------------------------------
function Serialize(tTable,sTableName,hFile,sTab)
	sTab = sTab or "";
	write(hFile,sTab..sTableName.." = {\n");
	for key,value in tTable do
		local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value,sKey,hFile,sTab.."\t");
		else
			local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
			write(hFile,sTab.."\t"..sKey.." = "..sValue);
		end
		write(hFile,",\n");
	end
	write(hFile,sTab.."}");
end
----------------------------------------------------------------------------------------------------------------------------------------------
function GetRates()
	socket, e = connect("www.x-rates.com", 80)
	if not e then
		socket:timeout(2)
		socket:send(GETHTML..strchar(13,10))
		while not e do
			line1,e = socket:receive("*l")
			foreachi(FindRates, function(a,b)
				if strfind(line1, b[1]) then 
					for i = 1,2 do 
						line2,e = socket:receive("*l")
						local _,_,num = strfind(line2,">(%S+)")
						if i == 1 and tonumber(num) then
							curRates[b[2].."-"..MainCurrency] = tonumber(num)
						elseif i == 2 and tonumber(num) then
							curRates[MainCurrency.."-"..b[2]] = tonumber(num)
						end
					end
				end
			end)
		end
		socket:close()
		curday = tonumber(date("%d"))
		curRates.n = 1
		WriteFile(curRates,"curRates","curRates.txt")
	else
		curRates.n = 0
		WriteFile(curRates,"curRates","curRates.txt")		
	end
end

SMF spam blocked by CleanTalk