Hi every one, hope this in right place
Snowman can u tell me if this is right :-
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("!removebotname")) ) then
frmHub:UnregBot(bot)
SendPmToNick(user.sName, Bot, " "Command" "done)
end
end
was trying to have the !rembot command on its on ,was going to give full creadits in the script since i got the idea from Ur mean machine script, i wont so i can test deffent bots out in privet hub with out running meanmachine in it just for 1 command that il use :)
thx if u can do it snowman :D
Yepp looks nice...
Remember One Thing...
frmHub:UnregBot(bot)
----- Obseverve the letters
SendPmToNick(user.sName, Bot, " "Command" "done)
-----
Make sure you have Bot and not bot...
Thanks NightLitch for that 1 :))
only prob now is i get this when i do a syntax check >
Syntax Error: `)' expected;
last token read: `Command' at line 5 in string "function DataArrival(user, data)
..."
sorry to be a pain but i just cant see where to put the )
?(
well i correct that error and change the code sligtly to :-
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
if( strfind(strlower(data),strlower("!removebotname") ) ) then
frmHub:UnregBot(Bot)
SendPmToNick(user.sName, Bot, "Command done")
end
end
end
but i think theres something missing , but i cant find it X(
(new to lua , so this be a second script for me , first was simple welcome meassge when ops log in)
heresit is ,so it only kills the bot named , just need to get it to do it on this command
!kil (any bots nick)
heres the script
-- Kill Bot Nick script by ((UKSN))shad_dow
-- idea from Snowman`s meanmachine script
-- help from NightLich
Bot = "Killer"
function Main()
frmHub:RegBot(Bot)
end
function DataArrival(user, data)
if( strsub(data, 1, 1) == "<" ) then
if( strfind( strlower(data), strlower("!kil")) ) then
frmHub:UnregBot(Bot)
end
end
end
Im not a big fan of lots of text and dislike using strsub etc so i usual try and cut down on using it, use as less text as possible, and it is quite much easier todo something like this if you are adding to a bot
Bot = "TheBotName"
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "!rembot" then
frmHub:UnregBot(Bot)
user:SendData(Bot, "Unregistered bot succesful")
return 1
end
end
end
SendPmToNick ive never liked using this 1 little bit, so i usually never use it..its supposed to be faster but not in my views of it.....
l8rr
Thankxs (uk-kingdom)pH?tt?
thats actuly loks alot clearner than mine :)))
and works a treat
expect for > Syntax Error: attempt to index global `frm' (a nil value) on ur code .
, all i got to do now is work out how to make it work on any bot namewhen i type the command like this in main ;_
!rembot (botsname) < as if it were type in main :)
:)
oops sorry
change this line
frm:UnregBot(Bot)
to
frmHub:UnregBot(Bot)
QuoteOriginally posted by ((UKSN))shad_dow
Thankxs (uk-kingdom)pH?tt?
thats actuly loks alot clearner than mine :)))
and works a treat
expect for > Syntax Error: attempt to index global `frm' (a nil value) on ur code .
, all i got to do now is work out how to make it work on any bot namewhen i type the command like this in main ;_
!rembot (botsname) < as if it were type in main :)
:)
ok heres a start
Bot = "TheBotName"
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "!rembot" then
s,e,cmd,botsname = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
frmHub:UnregBot(botsname)
user:SendData(Bot, "Unregistered bot succesful")
return 1
end
end
end
but now you need it to stop unregging users, only bots, or it can cause an nick taken error
hmm try this
--Unregister bot by Phatty
--v1.50
Bot = "TheBotName"
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == "!rembot" then
s,e,cmd,botsname = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
if GetItemByName(botsname) then
user:SendData(Bot, "Unregister bot unsuccesful")
return 1
else
frmHub:UnregBot(botsname)
user:SendData(Bot, "Unregistered bot succesful")
end
return 1
end
end
end
enjoy ;)
--Unregister bot by Phatty
--v1.51
Bot = "TheBotName"
Command = "!rembot" -- +
Success = "Unregistered bot succesful"
Unsuccess = "Unregister bot unsuccesful"
function DataArrival(user,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd == Command then
s,e,cmd,botsname = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
if GetItemByName(botsname) then
user:SendData(Bot,Unsuccess)
return 1
else
frmHub:UnregBot(botsname)
user:SendData(Bot,Success)
end
return 1
end
end
end
cheers M8ty , il try it and get back to u asap ..
oh and happy new year :)))
:D :D back ....yep just wot i wonted it to do phatty , BIG CHEERS for that 1 m8ty , :D :D :D :D
QuoteOriginally posted by ((UKSN))shad_dow
:D :D back ....yep just wot i wonted it to do phatty , BIG CHEERS for that 1 m8ty , :D :D :D :D
yw welcome ;)
thats what i joined this forum for, (and the last one), to get help and to give help ;)
l8rr