Author Topic: Nick Prefix  (Read 3850 times)

0 Members and 1 Guest are viewing this topic.

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Nick Prefix
« on: 05 December, 2007, 22:23:55 »
Hi i need a script to do the following :
Do not allow a user to connect if he doesn't have before his nick a tag like this
[Fxx]Nick ...where xx is the second group of digits from his ip ...
For example .... if Harold wanna connect to my hub and his ip is 79.20.255.255 he will not be able to connect to my hub until he doesn't have this nick [F20]Harold...and a message will appear to him ... "You're nick must be like this :[Fxx]nick.


I'll be more then happy if you will help me  ::)

PtokaX forum

Nick Prefix
« on: 05 December, 2007, 22:23:55 »

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: Nick Prefix
« Reply #1 on: 06 December, 2007, 16:19:29 »
Code: [Select]

NewUserConnected = function(User)
local _,_,sReqPref = User.sIP:find("%d+%.(%d+)%.%d+%.%d+")
local UserNick = tAPI.GetNick(User)
if UserNick:find("^%[%F"..sReqPref.."%]") == nil then
tAPI.RemoveUser(User, "Your nickname must start with [F"..sReqPref.."] . Please fix this and return")
end
end
UserConnected = NewUserConnected


tAPI = {
["GetNick"] = function(User)
if Core then
return User.sNick
else
return User.sName
end
end,
["RemoveUser"] = function(User,sMessage)
if Core then
Core.SendToUser(User, "<"..SetMan.GetString(21).."> "..sMessage.."|")
Core.Disconnect(User)
else
User:SendData(frmHub:GetHubBotName(),sMessage)
User:Disconnect()
end
end,
}
« Last Edit: 06 December, 2007, 16:21:26 by CrazyGuy »

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Re: Nick Prefix
« Reply #2 on: 06 December, 2007, 16:58:03 »
Hi CrazyGuy ... I just tried to use the script and it's not working ... users can still connect without prefix.

I'm getting this message in ptokax script console :
Code: [Select]
[05:50] Syntax ...s and Settings\user\D:\Ptokax\scripts\Prefix.lua:2: attempt to index field `sIP' (a string value)
I'm using Ptokax 0.3.5.0 !

Offline CrazyGuy

  • Viking
  • ****
  • Posts: 506
  • Karma: +83/-20
    • ?????=-_The NightHawk_-=?????
Re: Nick Prefix
« Reply #3 on: 06 December, 2007, 22:49:25 »
Hi CrazyGuy ... I just tried to use the script and it's not working ... users can still connect without prefix.

I'm getting this message in ptokax script console :
Code: [Select]
[05:50] Syntax ...s and Settings\user\D:\Ptokax\scripts\Prefix.lua:2: attempt to index field `sIP' (a string value)
I'm using Ptokax 0.3.5.0 !

Please upgrade to 0.3.6.0

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Re: Nick Prefix
« Reply #4 on: 07 December, 2007, 01:45:08 »
thank you  a lot guys ....you really helped me !!!
  ;D  ;D  ;D

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Re: Nick Prefix
« Reply #5 on: 07 December, 2007, 12:11:10 »
I have just one more problem: Can you adjust the script to allow users with [Fxx] and [fxx]...because it's not working with [fxx]

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Re: Nick Prefix
« Reply #6 on: 10 December, 2007, 00:35:49 »
tx a lot mutor ;)

Offline moo

  • Junior Member
  • **
  • Posts: 20
  • Karma: +3/-0
Re: Nick Prefix
« Reply #7 on: 14 April, 2008, 11:19:27 »
Can you pls make one more change ! Only master and operators are allowed to connect to the hub without a tag ! And i want 3 more profiles to be able to do that : Vip's and lets say : Profile 1 and Profile 2 ...i'll change the name of it later !

PtokaX forum

Re: Nick Prefix
« Reply #7 on: 14 April, 2008, 11:19:27 »