NickBan(), can't get it working with offline users...
 

NickBan(), can't get it working with offline users...

Started by NightLitch, 05 November, 2003, 16:26:33

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

NightLitch

Is it possible to Nickban offline users using script???

I can't get this working....

It works great with built in.. but I want to log the ban...

--NICKBAN---------------------------------------------------------------------------------------------------
function doNickBan(curUser, data,cmd)
	local s,e,cmd,nick,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" )
	if not nick then
		curUser:sendmessage(BOTNAME,"Syntax: "..PREFIXA.."nickban  [reason]")
		return 1
	end

------ THIS PART

	local vUser = GetItemByName(nick)
	if not vUser then
		SendToAll(BOTNAME,"User "..nick.." has been NickBanned by "..curUser.sName.."")
		nick:NickBan()
		local f = openfile("GR8-files/bans.dat", "a")
		if f then
		write(f, strlower(nick).." none "..reason,SHOWTIME.."\r\n")
		closefile(f)
		end
		return 0
	end

------- THIS PART

	if (reason == "") then reason = "for no reason"
	else reason = ""..reason
	end

	local f = openfile("GR8-files/bans.dat", "a")
	if f then
		write(f, strlower(nick).." "..vUser.sIP.." "..reason,SHOWTIME.."\r\n")
		closefile(f)
	end


	vUser:SendPM(BOTNAME,"You are being NickBanned by "..curUser.sName.." because: "..reason)
	vUser:NickBan()

	SendToAll(BOTNAME,"User "..nick.." has been NickBanned by "..curUser.sName.." because: "..reason)
	return 1
end


plz help me out / NightLitch
//NL

NightLitch

This is the error I got:


Syntax error: attempt to index local `nick' (a string value)
//NL

NightLitch

Have also problem resolving Ban()

BanIP:Ban()

Syntax error: attempt to index local `BanIP' (a string value)
//NL

NightLitch

plz guys.... Opium, Optimus, Skrollster, Ph?tty....
//NL

Optimus

nope that not possible offline = offline so that's hard to get

more guys have asked that question on old forum, never seen a other answer then NO.

Tryed my self to but not working... sorry

maybe some 1 else has a solution... but will have to see about that ;)

pHaTTy

NickBan it is possible to ban the nick whilst they are out of the hub, and banning the ip with from there nick whilst they are offline, requires alot of script, and it to log every single user that connects..............brrrrrrrr
Resistance is futile!

Guibs

Hi there,,

the line:
----
nick:NickBan()
----
Is the bad one,... :s

Because it's about :
----
- added user class methods:
   Ban()
   NickBan()

-- (from the scripting.txt file,, by ptaczek)
----
so,, it's means Ban() & NickBan() are about an user-object, (means the guy is connected) and not about a string,....
Then,, if the function 'doNickBan' is called after the inbuild command (!nickban), and the user is not connected,, you should maybe try:
--------
--NICKBAN---------------------------------------------------------------------------------------------------
function doNickBan(curUser, data,cmd)
	local s,e,cmd,nick,reason = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)" )

	if not nick then
		curUser:sendmessage(BOTNAME,"Syntax: "..PREFIXA.."nickban  [reason]")
		return 1
	end

	local vUser = GetItemByName(nick)
	if not vUser then
		reason = "N/A - off line ban"
		local f = openfile("GR8-files/bans.dat", "a")
		if f then
			write(f, strlower(nick).." none "..reason,SHOWTIME.."\r\n")
			closefile(f)
		end
		return 0
	else

		if (reason == "") then reason = "for no reason"
		else reason = ""..reason
		end

		local f = openfile("GR8-files/bans.dat", "a")
		if f then
			write(f, strlower(nick).." "..vUser.sIP.." "..reason,SHOWTIME.."\r\n")
			closefile(f)
		end
	
		vUser:SendPM(BOTNAME,"You are being NickBanned by "..curUser.sName.." because: "..reason)
		vUser:NickBan()

		SendToAll(BOTNAME,"User "..nick.." has been NickBanned by "..curUser.sName.." because: "..reason)
		return 1

	end

--	SendToAll(BOTNAME,"User "..nick.." has been NickBanned by "..curUser.sName.."")
--	nick:NickBan()

end
-------
And you can't use any reason with the inbuild command, if the guy is not connected, yep,... :s

Same thing for your:
-------
BanIP:Ban()

Syntax error: attempt to index local `BanIP' (a string value)
-------
You can't use :'Ban()' with a string,... but only with an 'user-object'...
-------
   local vUser = GetItemByName(nick)
   if vUser then
      vUser:Ban()
   end
--------
Good luck,,.... :)

l8tr, ;)
-- Please,... don\'t ask help in Pm,...Forums are made for that, to help everyone & my Inbox pm will be safe,... Thks,,  :))  --
CB forum     /     CB Home page

NightLitch

ThX Guibs... helps alot...
//NL

plop

so if the user object would be build with the bot it would be posible 2 do it ???
(sorry if it's a stupid/dumb question, my brain isn't working 2 good. still pi**ed about last night).

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 <----<<

NightLitch

Is it possible in any way to get the return 0 data to be sent in Bot...

will explain more clearly...


Send To Bot -- !nickban... can't I nickban i BOT or need the user to be online???

/NightLitch
//NL

NightLitch

Fixed a thing and two, and learn some too....

l8r...


/NightLitch
//NL

Optimus

hehe, i knew that. lol

i was just thinking in a other direction, with a return 1 & user:Ban() / user:NickBan()

And discoverd that it didn't worked...

Have a good 1

latersss

SMF spam blocked by CleanTalk