determinate determinate

Author Topic: Check Nick Names  (Read 1270 times)

0 Members and 1 Guest are viewing this topic.

Offline Pieltre

  • Member
  • ***
  • Posts: 40
  • Karma: +0/-0
Check Nick Names
« on: December 04, 2008, 07:29:58 pm »
Hi,

There use to be this feature in previous version of Ptokax (0.3.5.2 for instance) under the tab RULES, where you could force an Unreg to connect to your hub only if he has a certain prefix.  In my case, I imposed [GUEST], so we could clearly see who's new and who's not.   To that, I had a script that prevented anybody with that prefix to download, search the hub or chat with anybody but the OPs.   I would love to get that feature, but in the 0.4.1.1 version i'm using, it doesn't exist (or perhaps it was renamed and I couldn't find it).  In the meantime, anybody knows any script that could perform this?

Thanks in advance,
Pieltre

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Check Nick Names
« Reply #1 on: December 05, 2008, 04:35:53 am »
Although there is no problem in scripting that for the new API,
I do feel it's in bad form to rely on that prefix for the blocks.
You should formally check the user profile for that function.

Anyway here is the code you requested.
Code: [Select]
local Prefix = "[GUEST]"

MyINFOArrival = function(user,data)
if user.iProfile == -1 and user.sNick:sub(1,#Prefix) ~= Prefix then
local Bot,Hub = SetMan.GetString(21),SetMan.GetString(0)
local Msg1 = "Sorry "..user.sNick..", "..Hub.." requires you to prefix your nick with the tag: "..Prefix
local Msg2 = "You may return with the nickname: "..Prefix..user.sNick..", you will now be disconnected."
return Core.SendPmToUser(user,Bot,Msg1.."|"),Core.SendPmToUser(user,Bot,Msg2.."|"),Core.Disconnect(user),true
end
end
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Pieltre

  • Member
  • ***
  • Posts: 40
  • Karma: +0/-0
Re: Check Nick Names
« Reply #2 on: December 05, 2008, 09:17:56 pm »
Great job!  Works fine.

Offline cantatas

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Check Nick Names
« Reply #3 on: December 06, 2008, 05:35:13 pm »
Hello Mutor,

Thanks for this useful script.

Is it possible to modify it so that different prefixes are accepted?

e.g.: [GUEST]Nick is accepted (as it is now)
       [Guest]Nick is accepted too
       [guest]Nick...


Many thanks for your help

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Check Nick Names
« Reply #4 on: December 06, 2008, 10:47:56 pm »
Of course but then it is not quite the the same thing is it?
I don't know why so many people want to ignore letter case.
If that kind of thing is acceptable for you then here you go:

Code: [Select]
local Prefix = "[GUEST]"

MyINFOArrival = function(user,data)
if user.iProfile == -1 and user.sNick:sub(1,#Prefix):lower() ~= Prefix:lower() then
local Bot,Hub = SetMan.GetString(21),SetMan.GetString(0)
local Msg1 = "Sorry "..user.sNick..", "..Hub.." requires you to prefix your nick with the tag: "..Prefix
local Msg2 = "You may return with the nickname: "..Prefix..user.sNick..", you will now be disconnected."
return Core.SendPmToUser(user,Bot,Msg1.."|"),Core.SendPmToUser(user,Bot,Msg2.."|"),Core.Disconnect(user),true
end
end
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline cantatas

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Check Nick Names
« Reply #5 on: December 08, 2008, 02:21:10 pm »
What is extraordinary with you Mutor, it is your precision and your fastness of action. You and Snooze make easier our tools of communication with our members a lot.
Best regards

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: Check Nick Names
« Reply #6 on: December 09, 2008, 12:30:15 am »
It's kind of you to both notice and to say.
Perhaps he and I should join forces and then
we can offer solutions before they are even
asked for. The only problem is who will get
top billing. Snooztor or Mutooze?
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

 

determinate determinate
guestbook