Help please convert script to lua 5
 

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

Help please convert script to lua 5

Started by Op, 25 May, 2006, 15:01:12

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Op

Please convert to lua 5 thank

-----------------------------------------------------------------
-- A.I. Anti Advertising v1.1 - written by Guibs 21th Apr 2003 --
-----------------------------------------------------------------
---------------------
-- Version History --
---------------------
-- Converted to Lua5 By Jelf 10/03/05
-- v1.1 Changes synthax about 'strfind' (Thks to sedulus for the tips), by Guibs 21th Apr 2003
-- v1.1 added +allowedadd, +refusedadd commands (Thks to Dazzler for the ideas), by Guibs 21th Apr 2003
-- v1.0 first version. Greets to sebastiannielsen for the cool idea

-- It works in PM, and on the main chat & blocks the bad addresses
-- Ops can't be kicked
-- Edit the safeadd list, to put your good hub addresses

------------------------------------
-- Sourcecode is below this point --
------------------------------------

safeadd = {
["landofps.ath.cx"]=1,
["landofps2.ath.cx"]=2
}

trigs = {
["dns2go"]=1,
["myftpsite"]=2,
["servebeer"]=3,
["mine.nu"]=4,
["ip.com"]=5,
["dynip"]=6,
["staticip"]=7,
["serveftp"]=8,
["ipactive"]=9,
["ip.org"]=10,
["servegame"]=11,
["ath.cx"]=12,
["dyndns"]=13,
["clanpimp"]=14,
["idlegames"]=15,
["sytes"]=16,
["uni.cc"]=17,
["homeunix"]=18,
["deftonzs.com"]=19,
["flamenap"]=20,
["xs4all"]=21,
["serveftp"]=22,
["myftp"]=23,
["http://www.angelfire.com"]=24,
["hopto.org"]=25,
["orgdns"]=26
}

---------------------
-- Global Settings --
---------------------
returndata = 0
founded = 0
safe = 0
allowedadd = 0
refusedadd = 0
opchat = frmHub:GetOpChatName()
Bot = frmHub:GetHubBotName()
---------------------------------
function ChatArrival(user, data)
if (string.sub(data,1,1)=="<") then
data=string.sub(data,1,string.len(data)-1)
s,e,to,cmd=string.find(data,"<(.*)>%s+(%S+)")
cmd=string.lower(cmd)
s,e,cmd = string.find(data,"%b<>%s+(%S+)")
if user.bOperator then
if (cmd=="+allowedadd") then
user:SendData(Bot, allowedadd.." allowed addresses have been sent on the main chat or in pm")
returndata = 1
return 1
elseif (cmd=="+refusedadd") then
user:SendData(Bot, refusedadd.." refused addresses have been sent on the main chat or in pm")
returndata = 1
return 1
end
end
if user.bOperator then
else
for key,a in trigs do
if(string.find(string.lower(data),key,5,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,5,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToOps(opchat, user.sName.." has been disconnected because of advertising: "..data )
user:SendData(Bot, "You have been disconnected because of advertising")
user:Disconnect()
end
end
end
end
end
-----------------------------
function ToArrival(user, data)
if(string.sub(data, 1, 4) == "$To:") then
data=string.sub(data,1,string.len(data)-1)
s,e,whoTo = string.find(data,"$To:%s+(%S+)")
s,e,To,from,cmd = string.find(data,"$To:%s+(%S+)%s+From:%s+(%S+)%s+$%b<>%s+(.*)")
if user.bOperator then
else
for key,a in trigs do
if(string.find(string.lower(data),key,17,1)) then
founded = 1
break
end
end
if founded == 1 then
for safekey,a in safeadd do
if(string.find(string.lower(data),safekey,17,1)) then
safe = 1
break
end
end
end
if founded == 1 then
if safe == 1 then
allowedadd=allowedadd+1
else
returndata = 1
refusedadd=refusedadd+1
SendPmToOps(opchat, user.sName.." has been disconnected because of advertising: "..data )
user:SendData(Bot, "You have been disconnected because of advertising")
user:Disconnect()
end
end
end
end
return returndata
end

Herodes

#1
Quote from: Op on 25 May, 2006, 15:01:12
Please convert to lua 5 thank
-----------------------------------------------------------------
-- A.I. Anti Advertising v1.1 - written by Guibs 21th Apr 2003 --
-----------------------------------------------------------------
---------------------
-- Version History --
---------------------
-- Converted to Lua5 By Jelf 10/03/05
-- v1.1 Changes synthax about 'strfind' (Thks to sedulus for the tips), by Guibs 21th Apr 2003
-- v1.1 added +allowedadd, +refusedadd commands (Thks to Dazzler for the ideas), by Guibs 21th Apr 2003
-- v1.0 first version. Greets to sebastiannielsen for the cool idea
Uhm .. read this again ..

Also next time pls don't be so impatient to post..
Use the proper way for posting code.. you should use the [ code] [ /code] formating

SMF spam blocked by CleanTalk