Help With command !rembot
 

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 With command !rembot

Started by ((UKSN))shad_dow, 31 December, 2003, 21:20:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

((UKSN))shad_dow

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
creator of Therapy-X? bot

NightLitch

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...
//NL

((UKSN))shad_dow

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 )

 ?(
creator of Therapy-X? bot

((UKSN))shad_dow

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)
creator of Therapy-X? bot

((UKSN))shad_dow

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
creator of Therapy-X? bot

pHaTTy

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
Resistance is futile!

((UKSN))shad_dow

#6
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 :)

:)
creator of Therapy-X? bot

pHaTTy

oops sorry

change this line

         frm:UnregBot(Bot)


to

         frmHub:UnregBot(Bot)
Resistance is futile!

pHaTTy

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
Resistance is futile!

pHaTTy

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 ;)
Resistance is futile!

pHaTTy

--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
Resistance is futile!

((UKSN))shad_dow

cheers M8ty , il try it and get back to u asap ..
oh and happy new year :)))
creator of Therapy-X? bot

((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
creator of Therapy-X? bot

pHaTTy

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
Resistance is futile!

SMF spam blocked by CleanTalk