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
This is the error I got:
Syntax error: attempt to index local `nick' (a string value)
Have also problem resolving Ban()
BanIP:Ban()
Syntax error: attempt to index local `BanIP' (a string value)
plz guys.... Opium, Optimus, Skrollster, Ph?tty....
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 ;)
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
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, ;)
ThX Guibs... helps alot...
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
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
Fixed a thing and two, and learn some too....
l8r...
/NightLitch
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