Converting illegal vip script
 

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

Converting illegal vip script

Started by Anna, 29 March, 2005, 21:08:36

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Anna

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

jiten

#1
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.

Anna

#2
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....

[_XStaTiC_]

this script works, accept when an user use [UK][VIP] then the script does not respond.

Anna

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

Anna

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

Jelf

#6
**edit, probs with code

jiten

First post updated.
I guess it's working well now.

Cheers

Anna

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

bastya_elvtars

$ValidateNick is deprecated. We have to find a new way. We are working on it with plop atm, i dunno the quicklist proto. :(
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk