PtokaX forum

Archive => Archived 5.1 boards => Help with scripts => Topic started by: Genius on 11 January, 2007, 13:48:37

Title: Convert lua 5
Post by: Genius on 11 January, 2007, 13:48:37
HI

I need help plz

plz convert this script for ptokax 0.3.5.2

--=[ Nome dos Bots ]=-

BotName = "??ec?rit?-??t?"

--=[ Comandos ]=-

Files = {
["!regras"] = "SD/regras.txt",
["!rules"] = "SD/regras.txt",
["!regras2"] = "SD/regras2.txt",
}

--=[ C?digo ]=-

function ChatArrival(user, data)
s,e,msg = string.find(data, "%b<> ([ -z]*)")
for key, value in Files do
if( string.find( string.lower(msg), key) ) then
txtToShow, x = string.gsub(value, "%b[]", user.sName)
SendToAll(BotName, teste)
Show(user, TheFile)
SendToAll(BotName, teste)
return 1
end
end
end

function Show(user, TheFile)
local file = io.input(txtToShow)
local line = io.read("*a")
msg = msg.."\r\n"..line.."\r\n"
user:SendPM(BotName, msg)
file:read()
file:close()
end
Title: Re: Convert lua 5
Post by: Herodes on 11 January, 2007, 17:26:47
You don't need a conversion on this script. Just enable the textfile support.
HINT: Examine the GUI of PtokaX search around, you'll find it ;)
Title: Re: Convert lua 5
Post by: Genius on 11 January, 2007, 17:59:39
Hihihihihihihi

Tankx
Title: Re: Convert lua 5
Post by: jay-dee on 11 January, 2007, 18:26:24
--convert to LUA 5.1


--=[ Nome dos Bots ]=-

BotName = "??ec?rit?-??t?"

--=[ Comandos ]=-

Files = {
["!regras"] = "SD/regras.txt",
["!rules"] = "SD/regras.txt",
["!regras2"] = "SD/regras2.txt",
}

--=[ C?digo ]=-

function ChatArrival(user, data)
s,e,msg = string.find(data, "%b<> ([ -z]*)")
for key, value in pairs(Files) do
if( string.find( string.lower(msg), key) ) then
txtToShow, x = string.gsub(value, "%b[]", user.sName)
SendToAll(BotName, teste)
Show(user, TheFile)
SendToAll(BotName, teste)
return 1
end
end
end

function Show(user, TheFile)
local file = io.input(txtToShow)
local line = io.read("*a")
msg = msg.."\r\n"..line.."\r\n"
user:SendPM(BotName, msg)
file:read()
file:close()
end