i don't undertand because the random message doesn't start.
BotName = "???[Bot]M?GAPLATZ???"
nummsgop = 9
dofile("files/msgop.lua")
function Main()
frmHub:RegBot(BotName)
end
function Opconnected(user)
reply = Random(user)
SendToAll(BotName,reply)
end
function Flood(user)
s,e,cmd,str,num,msg = strfind(data, "%b<>%s(%S+)%s(%S+)%s(%S+)%s(%S+)")
if cmd ~= nil and str ~= nil and num ~= nil and msg ~= nil then
SendToNick(user.sName, BotName, "Hai floodato "..str.." per "..num.." volte con il messaggio "..msg)
count = tonumber(num)
for z = 1, count do
SendPmToNick(str, BotName, msg)
end
elseif str == user.sName then
SendToNick(user.sName, "Non puoi auto floodarti")
end
return 1
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = nil
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
end
end
in files/msgop there is this code:
function RandomOpMsg(user)
test = random(nummsgop)
x1 = user.sName.." appare dalle tenebre"
x2 = user.sName.." esce fuori da una nube proprio come fanno i ninja"
x3 = "La sua fama lo precede, ? tra noi "..user.sName
x4 = "Tutti lo conoscono tutti ci hanno parlato, ma nessuno in realt? sa chi si cela dientro "..user.sName
x5 = user.sName.." ? entrato, state attenti faker"
x6 = user.sName.." ? qui tra noi, non so voi ma io scappo :D"
x7 = user.sName.." ? arrivato miticooooooooooooo"
x8 = user.sName.." spalanca le porte di "..frmHub:GetHubName().." e con il suo scettro da operatore si prepara a distruggere i faker"
x9 = user.sName.." arriva col suo elicottero e atterra su " ..frmHub:GetHubName()
dostring("ret=x"..test)
return ret
end
QuoteOriginally posted by DorianG
i don't undertand because the random message doesn't start.
function Opconnected(user)
reply = Random(user)
SendToAll(BotName,reply)
end
in files/msgop there is this code:
function RandomOpMsg(user)
test = random(nummsgop)
x1 = user.sName.." appare dalle tenebre"
If we just look at the snippet of code here...
function Opconnected(user)
This should be
function OpConnected(user)
also in that function you assign a variable the result of a called function that doesnt exist.
reply = Random(user)
should be
reply = RandomOpMsg(user)
try that :)
Regards
Stravides
thanks Stravides, but there is an other error.
i have try that:
BotName = "???[Bot]M?GAPLATZ???"
nummsgop = 9
dofile("files\msgop.lua")
function Main()
frmHub:RegBot(BotName)
end
function OpConnected(user)
reply = RandomOpMsg(user) --//line12
SendToAll(BotName,reply)
end
function Flood(user)
s,e,cmd,str,num,msg = strfind(data, "%b<>%s(%S+)%s(%S+)%s(%S+)%s(%S+)")
if cmd ~= nil and str ~= nil and num ~= nil and msg ~= nil then
SendToNick(user.sName, BotName, "Hai floodato "..str.." per "..num.." volte con il messaggio "..msg)
count = tonumber(num)
for z = 1, count do
SendPmToNick(str, BotName, msg)
end
elseif str == user.sName then
SendToNick(user.sName, "Non puoi auto floodarti")
end
return 1
end
function DataArrival(user, data)
if (strsub(data,1,1) == "<") then
data = strsub(data,1,strlen(data)-1)
local s,e,cmd = nil
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
end
end
But Ptokax tell me: Syntax error: attempt to call global `RandomOpMsg' (a nil value)
stack traceback:
1: function `OpConnected' at line 12
Hi,
the problem is in this line...
dofile("files\msgop.lua")
it should be...
dofile("files/msgop.lua")
Best regards, nErBoS
ok, thank nerbos ;)