PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Jerry on 18 May, 2005, 22:31:35

Title: Regme (request for reg)
Post by: Jerry on 18 May, 2005, 22:31:35
Hi guys,

can you somebody help me with this script?

I need a script which, if the user type: +regme, send PM to all  OPerators, that the user ...  want to be registered -> likewise as in VerliHub.

THX guys in advance!!!
Title:
Post by: 6Marilyn6Manson6 on 18 May, 2005, 22:41:05
QuoteOriginally posted by Jerry
Hi guys,

can you somebody help me with this script?

I need a script which, if the user type: +regme, send PM to all  OPerators, that the user ...  want to be registered -> likewise as in VerliHub.

THX guys in advance!!!

VerliHub don't have support LUA script
Title:
Post by: TTB on 18 May, 2005, 22:48:31
Hm... I think he wants it in LUA, like in Verlihub. If he does, this is the script:

-- Reg note to OPs by TTB
-- Request by Jerry
-- 18-05-05
-----------------------------------

regcmd = "+regme"

bot = "--REG-Note--"

function Main()
frmHub:RegBot(bot)
end

function ChatArrival(user,data)
data=string.sub(data,1,string.len(data)-1)
s,e,regger = string.find(data, "%b<>%s+(%S+)")
if regger and regger == regcmd and user.iProfile == -1 then
SendPmToOps(bot, "The user:  "..user.sName.."  wants to be regged. Please help him")
return 1
end
end
Title:
Post by: Jerry on 18 May, 2005, 23:07:27
QuoteOriginally posted by TTB
 I think he wants it in LUA, like in Verlihub.  

Yes of course, this I think! :)

THX for the script TTB!!! ;)

btw.
 I have one more question.

It is possible: that this script, if the user want to be registered, he type: +regme, send PM to OPs (this is creat by TTB)
 and the OPerator, will be register only user's nickname and the script send PM to user: that he was registered and he must type his password, with command: +pass .... -> like in VerliHub
 
It is possible that?
I think -> this is good thing!

THX in advance guys!

P.S.
Sorry for my English!  :))
Title:
Post by: TTB on 19 May, 2005, 01:55:08
Here we go:

-- Reg note to OPs by TTB v.2
-- Request by Jerry
-- 18-05-05
-- Added: User can reg himself after he is put in table by Operator, timer also added.
-- Thanx Madman for the finishing the notification function
-- Added: PM to user with hub info and username + pasw. (31-05-05)
-----------------------------------

regcmd = "+regme"
regopcmd = "+regreg"
cpaswcmd = "+pass"

bot = "--REG-Note--"

loginmin = 5 -- time the user has to confirm with his pasw. Else the user will be deleted!

-- ## Please don't change below ## --

RegTable = {}

function Main()
frmHub:RegBot(bot)
SetTimer(1000*60)
StartTimer()
end

function ChatArrival(user,data)
data=string.sub(data,1,string.len(data)-1)
s,e,regger = string.find(data, "%b<>%s+(%S+)")
if regger and regger == regcmd and user.iProfile == -1 then
SendPmToOps(bot, "The user:  "..user.sName.."  wants to be regged. Please help him.")
user:SendData(bot, "Your request to REG you has been send! Please be patient, an OP will help you a.s.a.p.!")
return 1
elseif regger == regopcmd and user.bOperator then
local s,e,name = string.find(data, "%b<>%s+%S+%s+(%S+)")
if name == nil then
user:SendData(bot, "*** Syntax error! Please use: "..regopcmd.." ")
return 1
else
RegTable[name] = loginmin
SendPmToOps(bot, "User: "..name.." has been registrated by: "..user.sName..". He has "..loginmin.." min. to log in!")
SendPmToNick(name,bot, "You have been registered! Please type "..cpaswcmd.." to complete your registration! You have "..loginmin.." minutes to register!")
return 1
end
elseif regger == cpaswcmd and user.iProfile == -1 then
local s,e,pasw = string.find(data, "%b<>%s+%S+%s+(%S+)")
if pasw == nil then
user:SendPM(bot, "*** Syntax error! Please use: "..cpaswcmd.." ")
return 1
else
if RegTable[user.sName] ~= nil then
AddRegUser(user.sName.."",pasw, 3)
RegTable[user.sName] = nil
SendPmToNick(user.sName,bot, "You have been registered!\r\n\r\n\t"..string.rep("-",60).."\r\n\tUsername:\t"..user.sName.."\r\n\t"..
"Password:\t"..pasw.."\r\n\tHubname:\t"..frmHub:GetHubName().."\r\n\tHub Adress:\t"..frmHub:GetRegServer().."\r\n\t"..
string.rep("-",60).."\r\n\tPlease add this to your Favarites!")
SendToAll(bot, "*** Username = "..user.sName.." registered himself succesfully, userlevel = REG.")
return 1
else
user:SendPM(bot,"You are not in memory to be registrated! An OP has to REG you first temporary!")
return 1
end
end
end
end

function OnTimer()
for user,timer in pairs(RegTable) do
if timer > 0 then
RegTable[user] = RegTable[user] - 1
else
notification(user)
RegTable[user] = nil
end
end
end

function notification(user)
SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")
DelRegUser(user)
user = GetItemByName(user)
if user then
user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...")
end
return 1
end


ToArrival = ChatArrival

Note that only the users will be USERLEVEL 3! That means, the ONLY users who can be registrated this way will be a REG USER!


*Edited! Script is now up to date
Title: THX
Post by: Jerry on 20 May, 2005, 20:20:52
Thank you very much for the script TTB!!!
It's great -> that is, what I need it!!! ;)
Title:
Post by: Jerry on 20 May, 2005, 22:45:04
Hi guys,

I have a problem with the script!

In the script doesn't work the loginmin -> script only send pm to OPs: SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")
but doesn't send PM to user:user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...") ->  Syntax scripts\reg.lua:149: attempt to index local `user' (a string value)

Any ideas?

Thank you in advance!
Title:
Post by: Madman on 21 May, 2005, 01:17:48
Yep.. replace notification with this
function notification(user)
SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")
user = GetItemByName(user) -- User online?
DelRegUser(user.sName) -- Del user
user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...")
return 1
end
Title: THX Madman
Post by: Jerry on 21 May, 2005, 09:51:16
Thank you very much Madman!!!
Script work great at this time -> THX  :]
Title:
Post by: TTB on 21 May, 2005, 23:29:32
Thanx madman for finishing it... ghehe, stupid to forgot that lines  :D
Title:
Post by: Madman on 22 May, 2005, 02:00:00
Np... =)
Title: help
Post by: Jerry on 25 May, 2005, 17:04:04
Hi guys,

i have a liitle problem with this script.

If I reg some user and he don't write his password, with command: +pass, even after 5 min -> script should be deleted his registered nick, but script doesn't make this!!!

-> script report this error
 Syntax scripts\Reg.lua:154: attempt to index local `user' (a nil value)

function notification(user)

SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")

user = GetItemByName(user) -- User online?

DelRegUser(user.sName) -- Del user -> THE ERROR IS AT THIS LINE!!!

user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...")

return 1

end


Thank you in advance for help!
Title:
Post by: Madman on 25 May, 2005, 17:20:08
function notification(user)
SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")
DelRegUser(user)
user = GetItemByName(user)
if user then
user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...")
end
return 1
end

My bad...Now it works...
The error happend beacuse i checked first if user was online... then delete...
Now it deletes even if user is offline... =)

*Edit*

ops.. fixed an error...
Title:
Post by: Jerry on 25 May, 2005, 17:58:59
OK Madman -> Thank you very much!!!
Title:
Post by: Madman on 25 May, 2005, 18:31:16
Np =)
Title:
Post by: TTB on 26 May, 2005, 01:38:10
Post above updated...  :D
Title:
Post by: Dj_OcTaGoN on 28 May, 2005, 12:21:34
Very nice script, just one question, would the "+pass" command interfere with Robocop because "+regme" and "+regreg" works but when using "+pass" nothing happens (I have registertags on but no difference after disable it) :))

cheers//Octa
Title:
Post by: TTB on 29 May, 2005, 02:03:48
That's weird, because +regreg is also a Robocop command. In the script tab in PtokaX can you move up this script, so it is above the Robocop script. Try that first...
Title:
Post by: Dj_OcTaGoN on 29 May, 2005, 22:37:29
Yup I did but no difference unfortunately =/
I've also tried to disable the reg tag in Robocop, as well I have changed from "+" to "-" prefix in commands in script but "pass" doesnt work anywayz, the other does.
cheers
Title:
Post by: TTB on 29 May, 2005, 23:46:58
going to check!

*edited*

I haven't found any bugs! Try to change the "+pass" to something like "#pass" or "$password"...

I don't get it... Btw, I updated the post above, added a notification to the user after using the "+regme" command..
Title:
Post by: dkt on 31 May, 2005, 01:57:31
can someone modify this script to like.....if an operator regs some user......thn the operator himself gets a pm from bot which is as below ( as in xsthetic net server)

tell the user Xmen to put the following details in his favourite hubs...

nick - xmen
password - 123456
hub Addy - 178.23.56.86
hub name - Matrix Hub
Title:
Post by: TTB on 31 May, 2005, 08:53:12
Script above updated with your request... :D
Title:
Post by: dkt on 31 May, 2005, 12:57:30
script working fine..thanks mate...but it is not wat i wanted..
wen i type +regreg Zender ( no password reqd)
i get a pm from bot saying tat..user Zender has been registered by op dkt..he has 5 mins to login..
his name does not appear in ptokax ops/bans..and wen i tried to connected by nick Zender..i couldnt connect...

as my hub is only for registered users..i want a script tat would register users with command like
!addreguser nick password reg
thn after i do this i shld get a pm from bot displaying this message...
nick has been registered successfully..please tell him to add these details in his favourite hubs -
nick - nick
password - password
hub Addy - 178.23.56.86
hub name - Matrix Hub
thn i would copy paste these details to the user who is in some other hub...
can any1 modify the script like this ?
Title:
Post by: TTB on 31 May, 2005, 17:06:01
QuoteOriginally posted by dkt
script working fine..thanks mate...but it is not wat i wanted..
wen i type +regreg Zender ( no password reqd)
i get a pm from bot saying tat..user Zender has been registered by op dkt..he has 5 mins to login..
his name does not appear in ptokax ops/bans..and wen i tried to connected by nick Zender..i couldnt connect...

His name is indeed not banned / registrated. The name is saved in memory! The name will be erased after 5 min (or what you want)... This is also the time the user can reg himself with a password. So an OP doesn't REG the user, it only put the current name in memory so the user can REG himself! That will indeed give probs for you REG only hub, he can't login ghehe.

QuoteOriginally posted by dkt
as my hub is only for registered users..i want a script tat would register users with command like
!addreguser nick password reg
thn after i do this i shld get a pm from bot displaying this message...
nick has been registered successfully..please tell him to add these details in his favourite hubs -
nick - nick
password - password
hub Addy - 178.23.56.86
hub name - Matrix Hub
thn i would copy paste these details to the user who is in some other hub...
can any1 modify the script like this ?

If you want to have this, I can try to make that... But I recommend to use a script like Robocop. If you don't have any security bot, I wouldn't only use this script. Btw, adding users can also be done with the inbuild commands of PtokaX. The only different is that users can't reg themself... But if you have a REG only hub, the OP should be do that of course!
Title:
Post by: Dj_OcTaGoN on 01 June, 2005, 18:17:20
QuoteOriginally posted by TTB
going to check!

*edited*

I haven't found any bugs! Try to change the "+pass" to something like "#pass" or "$password"...

I don't get it... Btw, I updated the post above, added a notification to the user after using the "+regme" command..

Yup I've changed it to various prefixes but still

#regme and #regreg works, but not #pass (neither helping change it to #password and similar)
And there are no syntaxx errors.


*EDIT*

I found out why this was not working ^^ I had changed the Bot name to my mainbots name (Robocop Botname) and it seems the +pass didnt work then!

*EDIT*
Some requests along with this ;)
The user getting a notice after +regme, that he/she have to wait for a Operator to accept his/her reg request.
Also a notice when the user typed a password, it's easier to know if the user understood what to do that way :)


cheers
Title:
Post by: TTB on 01 June, 2005, 21:11:45
In the main chat will appear the message when a user has regged himself. Would you like to have that notice also to the OPs? Easy to do  :D

Please define you request
Title:
Post by: Dj_OcTaGoN on 01 June, 2005, 21:47:41
Ah yeah sry :D

A PM to OPs only (not in mainchat) when the user uses the +pass cmd.

The other one is that when the user use +regme cmd he will receive a message that a Operator must accept his register request :)

cheers
Title:
Post by: TTB on 01 June, 2005, 22:28:08
Try thisone (message to user can be changed in settings part):

-- Reg note to OPs by TTB v.2
-- Request by Jerry
-- 18-05-05
-- Added: User can reg himself after he is put in table by Operator, timer also added.
-- Thanx Madman for the finishing the notification function
-- Added: PM to user with hub info and username + pasw. (31-05-05)
-- Little changes for Dj_OcTaGoN (01-06-05)
-----------------------------------

-- ## Settings ## --


--> Here the text to the user who has asked to be regged with command "regcmd"
msguser = "Your request to REG you has been send! Please be patient, an OP will considder your request!"

regcmd = "+regme"
regopcmd = "+regreg"
cpaswcmd = "+pass"

bot = "--REG-Note--"

loginmin = 5 -- time the user has to confirm with his pasw. Else the user will be deleted!

-- ## Please don't change below ## --

RegTable = {}

function Main()
frmHub:RegBot(bot)
SetTimer(1000*60)
StartTimer()
end

function ChatArrival(user,data)
data=string.sub(data,1,string.len(data)-1)
s,e,regger = string.find(data, "%b<>%s+(%S+)")
if regger and regger == regcmd and user.iProfile == -1 then
SendPmToOps(bot, "The user:  "..user.sName.."  wants to be regged. Please help him.")
user:SendData(bot, msguser)
return 1
elseif regger == regopcmd and user.bOperator then
local s,e,name = string.find(data, "%b<>%s+%S+%s+(%S+)")
if name == nil then
user:SendData(bot, "*** Syntax error! Please use: "..regopcmd.." ")
return 1
else
RegTable[name] = loginmin
SendPmToOps(bot, "User: "..name.." has been registrated by: "..user.sName..". He has "..loginmin.." min. to log in!")
SendPmToNick(name,bot, "You have been registered! Please type "..cpaswcmd.." to complete your registration! You have "..loginmin.." minutes to register!")
return 1
end
elseif regger == cpaswcmd and user.iProfile == -1 then
local s,e,pasw = string.find(data, "%b<>%s+%S+%s+(%S+)")
if pasw == nil then
user:SendPM(bot, "*** Syntax error! Please use: "..cpaswcmd.." ")
return 1
else
if RegTable[user.sName] ~= nil then
AddRegUser(user.sName.."",pasw, 3)
RegTable[user.sName] = nil
SendPmToNick(user.sName,bot, "You have been registered!\r\n\r\n\t"..string.rep("-",60).."\r\n\tUsername:\t"..user.sName.."\r\n\t"..
"Password:\t"..pasw.."\r\n\tHubname:\t"..frmHub:GetHubName().."\r\n\tHub Adress:\t"..frmHub:GetRegServer().."\r\n\t"..
string.rep("-",60).."\r\n\tPlease add this to your Favarites!")
SendPmToOps(bot, "*** Username = "..user.sName.." registered himself succesfully, userlevel = REG.")
return 1
else
user:SendPM(bot,"You are not in memory to be registrated! An OP has to REG you first temporary!")
return 1
end
end
end
end

function OnTimer()
for user,timer in pairs(RegTable) do
if timer > 0 then
RegTable[user] = RegTable[user] - 1
else
notification(user)
RegTable[user] = nil
end
end
end

function notification(user)
SendPmToOps(bot, "User: "..user.." didn't REG him/herself after "..loginmin.." min.")
DelRegUser(user)
user = GetItemByName(user)
if user then
user:SendPM(bot, "Your time to log in has been expired. Please type again: '"..regcmd.."'  to let an OP reg you...")
end
return 1
end


ToArrival = ChatArrival
Title:
Post by: Dj_OcTaGoN on 03 June, 2005, 23:22:29
Thx m8 will try it our right away  :D

cheers//Octa
Title:
Post by: Genius on 09 June, 2005, 19:43:58
Hi

I try the comand +regme and receive this:

<--REG-Note--> The user:  Genius  wants to be regged. Please help him.

Can?t modify script for this:

<--REG-Note--> Please Op, regist user Genius, the password is xxxx

Sory About my inglish
Title:
Post by: TTB on 09 June, 2005, 23:02:32
The user gives the password with the +pass command!

This: <--REG-Note--> The user: Genius wants to be regged. Please help him. is when a user types "+regme".

The meaning of this script is that users can reg themselves.