PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: moo on 05 December, 2007, 22:23:55

Title: Nick Prefix
Post by: moo 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  ::)
Title: Re: Nick Prefix
Post by: CrazyGuy on 06 December, 2007, 16:19:29


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,
}
Title: Re: Nick Prefix
Post by: moo 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 :
[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 !
Title: Re: Nick Prefix
Post by: CrazyGuy on 06 December, 2007, 22:49:25
Quote from: moo 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 :
[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
Title: Re: Nick Prefix
Post by: moo on 07 December, 2007, 01:45:08
thank you  a lot guys ....you really helped me !!!
  ;D  ;D  ;D
Title: Re: Nick Prefix
Post by: moo 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]
Title: Re: Nick Prefix
Post by: moo on 10 December, 2007, 00:35:49
tx a lot mutor ;)
Title: Re: Nick Prefix
Post by: moo 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 !