i need a script that saves reasons of the bans and it displays that when a banned (time or perm) user wants to log in (not just 'your ass is banned'). Thx in advance!
hey bastya_elvtars,
i tried this a while agof or cslave and i came across the following results...
-=Perm IP Bans=-
when a banned ip enters the hub, ptokax itself handles banned ip when a connection is made, and then disconnects them with the message 'your ass...'. This means that side scripts never get any data from ptokax, therefor:- we cant rehandle the banip message. But, ...
-=Perm Nickname Bans=-
when a banned nick enters the hub, ptokax and anyother hub can only handle the banned name when the '$ValNick' command is received. This means that you can acutally handle a banned nick:- sending a ban message and disconnecting the socket, and then returning 1 to the process in ptokax
hope this helps
hey again bastya_elvtars...
There are some problems that will arise when adding this to some large hubscripts:- which is explained below the example.
neway, here's a little example of how to handle to banned nick entering the hub, ...
-- :: Example Banned Nick Handler by Noza
function Main()
frmHub:EnableFullData(1)
end
function DataArrival(tUser, sData)
if strsub(sData, 1, 13) == "$ValidateNick" then
local _,_, sUsername = strfind(sData, "$ValidateNick%s+(%S+)|")
if checkBanned(sUsername) then
-- :: this is where you do what you like
tUser:SendData("*** GotCha!")
tUser:Disconnect()
return 1
end
end
end
function checkBanned(sUsername)
readfrom("../PermBan.dat")
while 1 do
local sLine = read()
if sLine == nil or sLine == "" then
readfrom()
return
else
local _,_, sExpression = strfind(sLine, "(%S+)|")
if sExpression ~= nil then
if strlower(sExpression) == strlower(sUsername) then
readfrom()
return 1
end
end
end
end
end
its hard to write a complete script that sends the reason for why a connecting nick banned user was banned, because depending on what hub script you use:- the commands for banning are different. You will have to insert into the ban method, an output to a file.(in english, saving the reason to a file from the ban command in whatever script you may use)
And also aside this...sometimes ptokax wont send hub data after, the pervious send in a script returns 1 (in english, if one script handles "$ValNick" and returns 1, then the next one in line may not get the command sent to it), maybe...im not quite sure, but this seems to be what happens...
However, in the new cslave im writing, its completly based on being compatable with other large scripts:- if you want to use only a few features in cslave they can all be deleted or edited out, and if you want to add another script to cslave, just add the commands it uses, and cslave will pass it on, rather then handling them and then returning.
And there i go, just cant help myself...
neways, i hope ya learnt something new >:|>-<