Author Topic: Registration tag script  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

Offline christosgr

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Registration tag script
« on: 26 March, 2008, 01:42:19 »
Hello,
Can someone convert this script to API 2 please?

Thank you. :)


Code: [Select]
--[[
Registration and Tag registration script
by leun 3-9-06
thnx nErBoS and American Idiot for help in Self Register

little explanation:
 let users reg themseft without a reg-tag as REG profile.
 let users reg themself as VIP with a reg-tag
 REG users can self upgrade their profile into VIP if the have the correct reg-tag
]]--

tSettings = {
["sBot"] = "[BOT]Regger", --Botname
["sTag"] = "[POTN]", -- tag
["sBotOp"] = 1, -- Bot has key; 1 = yes, 0 = no
["SendMsgToOps"] = 1, -- Send a messege to Ops; 1 = yes, 0 = no
["SendMsgToAll"] = 1, -- Send a messege to All; 1 = yes, 0 = no
}

Main = function()
frmHub:RegBot(tSettings.sBot,tSettings.sBotOp, "Type +regme <pass> in main to reg yourself","")
end

NewUserConnected = function(curUser)
if curUser then
tFunctions.SendRC(curUser)
end
end

ChatArrival = function(curUser,data)
local data = string.sub(data,1,-2)
local s,e,Command = string.find(data,"%b<>%s+[%!%+%#](%S+)")
if Command then
if tCommands[Command] then
return tCommands[Command][1](curUser,data),1
end
end
end

tFunctions = {}
tFunctions.SendRC = function(curUser)
local s,e,sUsr = string.find(curUser.sName,"%"..tSettings.sTag.."(%S*)")
if curUser.iProfile == -1 then
if frmHub:isNickRegged(sUsr) then
curUser:SendData("$UserCommand 1 3 Register\\UPGRADE TO VIP$<%[mynick]> +upgrade&#124;")
else
curUser:SendData("$UserCommand 1 3 Register Me$<%[mynick]> +regme %[line:wachtwoord]&#124;")
end
elseif curUser.iProfile == 3 then
curUser:SendData("$UserCommand 1 3 Registrer\\UPGRADE TO VIP$<%[mynick]> +upgrade&#124;")
end
end

tFunctions.RegUser = function(curUser,sPass)
if curUser.iProfile == -1 or curUser.iProfile == 3  then
if (string.len(curUser.sName) >= string.len(tSettings.sTag) and string.sub(string.lower(curUser.sName),1,string.len(tSettings.sTag)) == string.lower(tSettings.sTag)) then
local RegCode = 2
tFunctions.RegUserAccount(curUser,sPass,RegCode)
else
if curUser.iProfile == 3 then
curUser:SendData(tSettings.sBot,"*** You dont have changed your nick in "..tSettings.sTag..""..curUser.sName..", please fix it and upgrade again.")
else
local RegCode = 3
tFunctions.RegUserAccount(curUser,sPass,RegCode)
end
end
else
curUser:SendData(tSettings.sBot,"*** You are already a registrated user")
end
end

tFunctions.RegUserAccount = function(curUser,sPass,What)
AddRegUser(curUser.sName,sPass, tonumber(What))
local Share,Gb,sHubName,sHubAdress = curUser.iShareSize,1024^3,frmHub:GetHubName(),frmHub:GetHubAddress()
if tonumber(What) == 3 then
blaad = "REG"
else
blaad = "VIP"
end
local sDisp
sDisp = "\r\n\r\n\t"..string.rep("=",85).." \r\n"
sDisp = sDisp.."\tYou are now registered, please login with this name & password and add this hub to your favorites\r\n"
sDisp = sDisp.."\t"..string.rep("=",85).." \r\n"
sDisp = sDisp.."\tHub naam: \t"..sHubName.." \r\n"
sDisp = sDisp.."\tHub adres: \t"..sHubAdress.." \r\n"
sDisp = sDisp.."\tYour nick: \t"..curUser.sName.." \r\n"
sDisp = sDisp.."\tYour pass: \t"..sPass.."\r\n"
sDisp = sDisp.."\tYour rank: \t"..blaad.." \r\n"
sDisp = sDisp.."\t"..string.rep("=",85).." \r\n"
sDisp = sDisp.."\t***Please reconnect and enter your password.***\r\n"
sDisp = sDisp.."\t"..string.rep("=",85).." \r\n"
curUser:SendPM(tSettings.sBot, sDisp)
if tSettings.SendMsgToOps == 1 then
SendPmToOps(tSettings.sBot, "(INFO) The user "..curUser.sName.." / "..curUser.sIP.." ("..(Share/Gb).." gb) heeft zich geregistreerd als "..blaad)
end
if tSettings.SendMsgToAll == 1 then
SendToAll(tSettings.sBot,"*** The user "..curUser.sName.." has just regged hisself as "..blaad.."!!")
end
end

tCommands = {
["regme"] = {
function(curUser,data)
local _,_,sPass = string.find(data, "%b<>%s+%S+%s+(%S+)")
if (sPass == nil) then
curUser:SendData(tSettings.sBot, "Syntax Error, +regme <pass>, you must write a password.")
return 1
elseif (string.find(sPass, "[%c|\n\r]")) then
curUser:SendData(tSettings.sBot, "Invalid Password. Try Again.")
return 1
elseif (string.find(curUser.sName, "[%c|\n\r]")) then
curUser:SendData(tSettings.sBot, "Your nick is invalid. Please choose a new one.")
return 1
end
tFunctions.RegUser(curUser,sPass)
end,
},
["upgrade"] = {
function(curUser,data)
if string.find(curUser.sName,tSettings.sTag) then
local s,e,sUsr = string.find(curUser.sName,"%"..tSettings.sTag.."(%S*)")
if curUser.iProfile == -1 then
if frmHub:isNickRegged(sUsr) then
local sPass = frmHub:GetUserPassword(sUsr)
DelRegUser(sUsr)
tFunctions.RegUser(curUser,sPass)
curUser:SendData(tSettings.sBot,"*** Your profile is upgraded to VIP")
else
curUser:SendData(tSettings.sBot,"*** You are not a regged user")
end
else
curUser:SendData(tSettings.sBot,"*** You are not allowed to use this command")
end
elseif curUser.iProfile == 3 then
curUser:SendData(tSettings.sBot,"*** You dont have changed your nick into "..tSettings.sTag..""..curUser.sName..", please fix it and upgrade again.")
else
curUser:SendData(tSettings.sBot,"*** You are not allowed to use this command")
end
end,
},
}
« Last Edit: 26 March, 2008, 01:44:01 by Mutor »

PtokaX forum

Registration tag script
« on: 26 March, 2008, 01:42:19 »