Author Topic: DataArrival not working...  (Read 1790 times)

0 Members and 1 Guest are viewing this topic.

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
DataArrival not working...
« on: 29 January, 2004, 02:35:02 »
Hi,

My function DataArrival sometimes stops working

Code: [Select]
function DataArrival(user, data)
if (Slots == "Activo") then
if strfind(data, "%b<>%s+("..Command..").*|") then
s, e, nr = strfind(data, "%b<>%s+"..Command.."%s+([0-9]+)")
if s then nr = tonumber(nr) else nr = 1 end
doSlots(user, nr) return 1
end
if strfind(data, "^%$SR") then
slotsOnHub(user, data)
end
end
if (Slots == "Desactivo") then
user:SendPM(Bot, "O comando !slots est? desactivado.")
return 1
end

if (AntiPUB == "Activo") then
  if (not user.bOperator) then
      if (( strsub(data, 1, 1) == "<" ) or ( strsub(data, 1, 4) == "$To:" )) then
        for i=1,getn(trigs) do
            if( strfind( strlower(data), trigs[i]) ) then
SendToAll(Bot, "O utilizador "..user.sName.." foi desconectado e kickado por publicidade." )
user:SendData(Bot, "Foste desconectado e kickado por publicidade.")
SendPmToOps(Bot, "O utilizador "..user.sName.." foi desconectado e kickado por publicidade.")
SendPmToOps(Bot, "O IP do utilizador era "..user.sIP.." .")
SendPmToOps(Bot, "O utilizador escreveu o seguinte: "..trigs[i])
user:Disconnect()
user:TempBan()
end
end
end
end
end
if (AntiPUB == "Desactivo") then
return
end
if (BadFiles == "Activo") then
if( strsub(data, 1, 3) == "$SR" ) then
if (not user.bOperator) then
_,_,nick = strfind( data, "\05(%S*)|$" )
local s = 5 + strlen(user.sName)
local e = strfind(data, "%d+%s%d+/%d+") - 2
local path = strsub(data, s, e)
if( nick == Bot and Kicked[user.sName] == nil ) then
Kicked[user.sName] = 1
Reason = FindWhat(data)
if (Reason == "Other files") then return end
user:SendData(Bot, "V?ce foi desconectado e banido. Raz?o: "..Reason)
user:SendData(Bot, "O file em causa encontra-se em: "..path.. ".")
user:SendData(Bot, "Desconectado....")
user:Disconnect()
user:TempBan()
end
end
end
end
if(BadFiles == "Desactivo") then
return
end

if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if (cmd=="!help") then
Help(user, data)
return 1

elseif (cmd=="!rede") then
Readtextfile(user, rede)
return 1
elseif (cmd=="!regras") then
Readtextfile(user, regras)
return 1

elseif (cmd=="!hubinfo") then
HubInfo(user,data)
return 1

elseif (cmd=="!myip") then
user:SendPM(Bot, "O teu IP ? : "..user.sIP.." !")
return 1


elseif (cmd=="!ops")then
msg = "Lista de Operadores:\r\n\r\n"
for i = 1, getn(opLevels) do
local tmp = GetUsersByProfile(opLevels[i])
foreach(tmp, function(id, op)
if GetItemByName(op) then
msg=msg.."\t"..op.."\t\tOnline\r\n"
else
msg=msg.."\t"..op.." \t\tOffline\r\n"
end end)
end
user:SendPM(Bot, msg)
return 1
elseif (cmd=="!time") then
GetTime()
user:SendPM(Bot, Date)
return 1
elseif (cmd=="!userinfo") then
UserInfo(user, data)
return 1
elseif (cmd=="!kickban") then
KickBan(user,data)
return 1
elseif (cmd=="!warn") then
Warn(user,data)
return 1
elseif (cmd=="!disconnect") then
Disconnect(user,data)
return 1
elseif (cmd=="!kick") then
Kick(user,data)
return 1
elseif (cmd=="!drop") then
Drop(user,data)
return 1
elseif (cmd=="!redirect") then
Redirect(user,data)
return 1
elseif (cmd=="!mm") then
if (user.bOperator) then
_,_,message = strfind( data, "%b<>%s+%S+%s+(.+)" )
SendPmToAll(Bot, "\r\n\r\n\----------------------------------------[Assunto do Hub]----------------------------------------\r\n\r\n"..message.."\r\n\r\nMensagem enviada por: "..user.sName)
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
end
return 1
elseif (cmd=="!mmop") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
_,_,message = strfind( data, "%b<>%s+%S+%s+(.+)" )
SendPmToOps(Bot, "\r\n\r\n\----------------------------------------[Mensgem para OPs]----------------------------------------\r\n\r\n"..message.."\r\n\r\nMensagem enviada por: "..user.sName)
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
end
return 1
elseif (cmd=="!clrtempban") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
ClearTempBan()
SendPmToOps(Bot, "A lista de ban?s temporarios foi limpa por : " .. user.sName)
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
end
return 1
elseif (cmd=="!mred") then
MudarMoradaRedir(user,data)
return 1
elseif (cmd=="!mshare") then
MudarShare(user,data)
return 1
elseif (cmd=="!mnome") then
MudarNomeHub(user,data)
return 1
elseif (cmd=="!mdesc") then
HubDesc(user,data)
return 1
elseif (cmd=="!mregmorada") then
MudarMoradaReg(user,data)
return 1
elseif (cmd=="!redtodos") then
RedirecionarTodos(user,data)
return 1
elseif (cmd=="!mmaxusers") then
MudarMaxUsers(user,data)
return 1
elseif (cmd=="!argredtodos") then
MudarRedAll(user,data)
return 1
elseif (cmd=="!argredcheio") then
MudarRedFull(user,data)
return 1
elseif (cmd=="!clrpermban") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
SendPmToOps(Bot, "A lista de ban?s permanentes foi limpa por : " .. user.sName)
return 0
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!restart") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
SendPmToOps(Bot, "O Hub vai ser reinicializado por : " .. user.sName)
return 0
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!restartscripts") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede") then
SendPmToOps(Bot, "Os scripts do Hub v?o ser reinicializado por : " .. user.sName)
return 0
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!gag") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
local arg = GetArgML(data)
if arg == nil then
user:SendData(Bot, "O utilizador "..arg.." n?o foi encontrado !")
else
local gagged = GetItemByName(arg)
gagged:SendPM(Bot, "Foste impedido de falar no Main-Chat !")
SendPmToOps(Bot, "O utilizador "..gagged.sName.." foi impedido de falar no Main-Chat por "..user.sName.." !")
end
return 0
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!ungag") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
local arg = GetArgML(data)
if arg == nil then
user:SendData(Bot, "O utilizador "..arg.." n?o foi encontrado !")
else
local gagged = GetItemByName(arg)
gagged:SendPM(Bot, "J? podes falar de novo no Main-Chat !")
SendPmToOps(Bot, "O utilizador "..gagged.sName.." foi de novo autorizado a falar no Main-Chat por "..user.sName.." !")
end
return 0
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!timeban") then
TimeBan(user,data)
return 1
elseif (cmd=="!ban") then
Ban(user,data)
return 1
elseif (cmd=="!aduser") then
RegistrarUsers(user, data)
return 1
elseif (cmd=="!rmuser") then
RemoverRegistro(user, data)
return 1
elseif (cmd=="!banip") then
BanIP(user,data)
return 0
elseif (cmd=="!unban") then
UnBan(user, data)
return 0
elseif (cmd=="!bloquear") then
SendAddGag(user,data)
return 1
elseif (cmd=="!desbloquear") then
SendDelGag(user,data)
return 1
elseif (cmd=="!bloqueados") then
SendGetGag(user,data)
return 1
elseif (cmd=="!banlist") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
Readtextfile(user, Banlist)
return 1
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!rmban") then
RemoveBan(user, data)
return 1
elseif (cmd=="!rmkick") then
RemoveKick(user, data)
return 1
elseif (cmd=="!kicklist") then
if (GetProfileName(user.iProfile) == "Master" or GetProfileName(user.iProfile) == "Fundador da Rede" or GetProfileName(user.iProfile) == "Operador" or GetProfileName(user.iProfile) == "Moderador" or GetProfileName(user.iProfile) == "Administrador") then
Readtextfile(user, Kicklist)
return 1
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
elseif (cmd=="!lmbanlist") then
LimparBan(user, data)
return 1
elseif (cmd=="!lmkicklist") then
LimparKicks(user, data)
return 1
elseif (cmd=="!vkick") then
VerKickados(user, data)
return 1
elseif (cmd=="!vban") then
VerBanidos(user, data)
return 1
end
end
if strsub(data,1,6) == "$Kick " then
return 1
end
if strfind(data,"is kicking") then
if (user.bOperator) then
_,_, kicker,name,reason = strfind(data,"<%S+>%s(%S*)%sis kicking%s(%S*)%sbecause:%s(.*)")
local userToBeKicked = GetItemByName(name)
local operador = GetItemByName(kicker)
local msg = ""
local temp = {}
local info = "Base-Dados/UserInfo/Kicks/"..userToBeKicked.sName..".kck"
SendToAll(Bot, "O utilizador "..userToBeKicked.sName.." foi kickado por "..operador.sName.." porque: "..reason)
userToBeKicked:SendPM(Bot, "Foste kickado por "..operador.sName.." porque: "..reason)
appendto(Kicklist)
write("\r\n"..userToBeKicked.sName.."\t"..userToBeKicked.sIP.."\t"..operador.sName.."\t"..reason.."\t"..GetTime())
writeto()
msg = msg..userToBeKicked.sName.."\t"..userToBeKicked.sIP.."\t"..operador.sName.."\t"..reason.."\t"..GetTime()
tinsert(temp, msg)
Writetextfile(info, temp)
WriteInfo(userToBeKicked)
userToBeKicked:TempBan()
return 1
else
user:SendPM(Bot, "N?o tens permiss?o para aceder a este comando !")
return 1
end
end

if strfind(data,"You are being kicked because:") then
return 1
end

if (gd == "Activo") then
if strsub(data,1,12) == "$ConnectToMe" then
          local _,_, From,ToIp = strfind(data,"$ConnectToMe%s+(%S+)%s+(%d+.%d+.%d+.%d+):.*")          
              readfrom(Gags)                
while 1 do
local line = read()
if line then          
ip = strsub(line, strfind(line, "|") + 1)
if ip == ToIp then
return 1          
end
else      
break
end
end
end
readfrom()
end

end

do i have something wrong ??? sometimes stops working
nothing works and doesn?t send any syntax error

Can anyone help me out ??
--## nErBoS Spot ##--

PtokaX forum

DataArrival not working...
« on: 29 January, 2004, 02:35:02 »

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #1 on: 29 January, 2004, 14:51:41 »
Hi,

Last night I was trying all strinf recived and the one that didn?t work is the commands and the kicking the others are working. I need help out here please.
--## nErBoS Spot ##--

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #2 on: 29 January, 2004, 16:01:04 »
_,_, kicker,name,reason = strfind(data,"%b<>%s*(%S+)%sis%skicking%s(%S+)%sbecause:%s*(.*)")
if this doesn't work then try this debug thingie for some hints.
now i look closer your filtering the right mouse kick.
Code: [Select]
if strsub(data,1,6) == "$Kick " then
                         user:SendData(Bot, "right mouse kick triggered :"..data)
return 1
end
an easy way 2 find where it goes wrong is inserting lines like this.
you can see on which point it stops working.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Offline nErBoS

  • Emperor
  • **
  • Posts: 1 149
  • Karma: +3/-1
(No subject)
« Reply #3 on: 29 January, 2004, 18:47:32 »
Well the stupid BOT started working again i supose thats it's because of the slots comand data so i made a script apart only with the slot command to see !!

Thanks anyway plop.

Best regards, nErBoS
--## nErBoS Spot ##--

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #4 on: 29 January, 2004, 22:10:25 »
Quote
Originally posted by nErBoS
Well the stupid BOT started working again i supose thats it's because of the slots comand data so i made a script apart only with the slot command to see !!

Thanks anyway plop.

Best regards, nErBoS
yw, and good luck on the further development of your bot.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

PtokaX forum

(No subject)
« Reply #4 on: 29 January, 2004, 22:10:25 »