Used to run this script before converting to new ptokax, and I've seen that I would still need it, if possible... I now run ptokax build 16.09 could be done by robocop I know, but since I'm in a network wher its possible a user that ment to get into another hub might end up in mine due to repointed addys, dont want them timebanned for 60 for using wrong prefix... and I want my ops to know for sure that the ones with vip tag really are vips...
ofcourse if there's another script in lua5 that works for this, i'd be happy to be pointed that way, I didnt find when I looked here though
/thanx Anna
Quote-- BadPrefixCheck by bastya_elvtars (the rock n' roll doctor)
-- based on AllowNick by Mutor
-- checks the prefix, it must be in right the beginning of the nick
-- checks only unregged users. if they log i with a bad account it means they are guests
-- // config
badpref ={ -- use lowercase please
"[vip]",
"[op]",
"[su]",
"(vip)", -- etc lost patience here :P
}
-- // end of config
function DataArrival(user,data)
if strsub(data, 1, 13) == "$ValidateNick" then
local sdata=strsub(data,1,strlen(data)-1)
local _,_,nm=strfind(sdata,"$ValidateNick%s+(%S+)")
determineprefix(nm)
end
end
function NewUserConnected(user)
if user.iProfile == -1 then
if checkprefix(user)=="shit" then return 1 end
end
end
function determineprefix(data)
local _,_,pr = strfind(data, "^([%[%{%(]%S+[%)%}%]])%S+")
prefix=strlower(pr)
end
function checkprefix(user)
local prefixes={}
for a=1,getn(badpref) do
prefixes[badpref[a]]=1
end
if not prefixes[prefix] then
user:SendData("NickNameCheck", "\r\nYou are not allowed to use this prefix::"..prefix)
user:Disconnect() prefixes=nil return "shit"
end prefixes={}
end
Try this one:
-- BadPrefixCheck by bastya_elvtars (the rock n' roll doctor)
-- converted to lua 5 by jiten
-- based on AllowNick by Mutor
-- checks the prefix, it must be in right the beginning of the nick
-- checks only unregged users. if they log i with a bad account it means they are guests
-- // config
badpref ={ -- use lowercase please
"[vip]",
"[op]",
"[su]",
"(vip)", -- etc lost patience here :P
}
-- // end of config
function ValidateNickArrival(user,data)
local sdata=string.sub(data,1,string.len(data)-1)
local _,_,nm=string.find(sdata,"$ValidateNick%s+(%S+)")
determineprefix(nm)
end
function NewUserConnected(user)
if user.iProfile == -1 then
if checkprefix(user)=="shit" then
return 1
end
end
end
function determineprefix(data)
local _,_,pr = string.find(data, "^([%[%{%(]%S+[%)%}%]])%S+")
prefix=string.lower(pr)
end
function checkprefix(user)
local prefixes={}
for a=1,table.getn(badpref) do
prefixes[badpref[a]]=1
end
if not prefixes[Prefix] then
user:SendData("NickNameCheck", "You are not allowed to use this prefix: "..prefix)
user:Disconnect() prefixes=nil return "shit"
end
prefixes={}
end
*[/EDIT] Typo mistake
Best regards.
sort of works.. it dont let them in.. and gives them a temp ban for 8 min...
problem is there's no info on why they are tempbanned...
If I change: user:SendData("NickNameCheck", "\r\nYou are not allowed to use this prefix::"..prefix)
to: user:SendPM("NickNameCheck", "\r\nYou are not allowed to use this prefix::"..prefix)
the mssage is sent in PM... and user is disconnected, but I'd prefere it to be sent in main
edit2: there's no timeban this time....
this script works, accept when an user use [UK][VIP] then the script does not respond.
if they put the vip tag after another tag, my ops would still be sure it aint a vip... but might be handy if that could be checked as well
nvm, works now... dunno what I did, but pretty sure I didnt do anything really... perhaps the first case was a client issue that prevented client from getting the message before disconnected
**edit, probs with code
First post updated.
I guess it's working well now.
Cheers
did get a few errors... might be cause some users dont have prefix.... changed code for
function determineprefix(data)
local _,_,pr = string.find(data, "^([%[%{%(]%S+[%)%}%]])%S+")
prefix=string.lower(pr)
end
to: function determineprefix(data)
local _,_,pr = string.find(data, "^([%[%{%(]%S+[%)%}%]])%S+")
if pr ~= nil then
prefix=string.lower(pr)
end
(added an if statement) still does the job, I'll test and se if there's some probs... said some about expecting a string and getting nil as problem before
$ValidateNick is deprecated. We have to find a new way. We are working on it with plop atm, i dunno the quicklist proto. :(