PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: DynamiteN on 03 July, 2007, 22:02:34

Title: A self register script with custom profile ..
Post by: DynamiteN on 03 July, 2007, 22:02:34
I need a self registration script
It should be like this ..
the user types..
!regme <upload> <nick> <pass>
so it wouild be like ..
!regme 1.0 DynamiteN password
1.0 is if the user has 1mbit ul ...
but whatever they type in the upload it will appear in theres nick ...

and then a pm get send to them automatic were it says something like this ..

   ------------------------------------------------------------------------------------------
   :::::::::::::::: You Have Been Registerd With the Following nick and password :::::::::::::::::
   ------------------------------------------------------------------------------------------
   || Nick:............. [1.0]DynamiteN                                                                               ||
   || pass:...........  password                                                                                       ||
   || Hub Adress:... xxx.xxx.xxx.xxx                                                                                ||
   || Hub name:......--=Godess=--                                                                                 ||
   ------------------------------------------------------------------------------------------
   :::::::::::::::::::::::::::Please change you're nick and reconnect:::::::::::::::::::::::::::::::::
   ------------------------------------------------------------------------------------------
Could any one maybe be kind and do this for me ???...
i would appriecheate (spell?) it

hellooo ..
could at least som1 answer if they want or can do this kind of script for me ?? ..
so i know if i have to come up with another solution ??

PLLLEeeeeeeaaasseeeeee ;)
Title: Re: A self register script with custom profile ..
Post by: Madman on 04 July, 2007, 22:01:05
I'll do it, but tomorrow, if i'm not to busy...
btw, why should they write there nick? wouldnt !regme <upload> <password> be enough?
the script can get the nick by itself
Title: Re: A self register script with custom profile ..
Post by: DynamiteN on 05 July, 2007, 14:29:12
yeah i guess....
Title: Re: A self register script with custom profile ..
Post by: baba.runner on 05 July, 2007, 19:21:15
Quote from: Madman on 04 July, 2007, 22:01:05
...
btw, why should they write there nick? wouldnt !regme <upload> <password> be enough?
the script can get the nick by itself
I even recommend that the script should take the nick by itself.
Otherwhise a user could register other user then himself, what is absolutely not recommended.
Title: Re: A self register script with custom profile ..
Post by: DynamiteN on 05 July, 2007, 19:23:48
yeah i agree ... the nick won't be needed there then ..
aslong as that upload comes in the front of the nick inside the "[ ]" ...
Title: Re: A self register script with custom profile ..
Post by: Madman on 05 July, 2007, 20:12:12
I worked  7-19 today, so i'm to tierd... i did some scripting...

I'm gonna add a table whre you can add the uplaod prefix you want to allow.
Beacuse if you allow any kind, you will probarly end up with user regging [ImSoCool]usernick.
I'm also gonna add cmds so Ops can add/remove prefixes...
Title: Re: A self register script with custom profile ..
Post by: DynamiteN on 05 July, 2007, 20:15:37
yeah that would be greeaaatt.. ;)...
i'm guessing you're a guy ..
but if not i would kiss you for doing this   :-* 8)
Title: Re: A self register script with custom profile ..
Post by: bastya_elvtars on 05 July, 2007, 21:26:30
Quote from: DynamiteN on 05 July, 2007, 20:15:37
yeah that would be greeaaatt.. ;)...
i'm guessing you're a guy ..
but if not i would kiss you for doing this   :-* 8)

Leave sexuality for the dying Capitalism. :-P
Title: Re: A self register script with custom profile ..
Post by: DynamiteN on 05 July, 2007, 21:40:56
hahaha.....
could kiss u to  :-*  ;D
Title: Re: A self register script with custom profile ..
Post by: Madman on 06 July, 2007, 15:59:21
Code (lua) Select

-- Upload prefix regme
-- Made by Madman
-- Request by DynamiteN

Bot = frmHub:GetHubBotName()

function Main()
frmHub:RegBot(Bot)
local file = io.open("Uploads.dat") -- Open file
if file then -- if could open file
file:close() -- close it
else -- if could not open
file = io.open("Uploads.dat","w+") -- open in write mode
file:write("Uploads = {\n}") -- write
file:close()
end
LoadFromFile("Uploads.dat")
end

function ChatArrival(user,data)
local data = string.sub(data,1,-2)
local s,e,cmd = string.find(data,"%b<>%s+%p(%S+)")
if cmd then
tCmds = {
["regme"] = function(user,data)
if user.bRegistered == nil then
local s,e,ul,pwd = string.find(data,"%b<>%s+%S+%s+(%S+)%s+(%S+)")
InTable = nil
if ul and pwd then
for _,tUl in ipairs(Uploads) do
if tUl == ul then
InTable = 1
end
end
if InTable then
Nick = "["..ul.."]"..user.sName
AddRegUser(Nick,pwd,3)
Msg = "\r\n\r\n"..
"------------------------------------------------------------------------------------------\r\n"..
":::::::::::::::: You Have Been Registerd With the Following nick and password :::::::::::::::::\r\n"..
"------------------------------------------------------------------------------------------\r\n"..
"II Nick:............. " ..Nick.. "                                                                               II\r\n"..
"II pass:...........  " ..frmHub:GetUserPassword(Nick).. "                                                                                       II\r\n"..
"II Hub Adress:... " ..frmHub:GetHubAddress().. ":" ..frmHub:GetHubPort().. "                                                                                II\r\n"..
"II Hub name:......" ..frmHub:GetHubName().. "                                                                                 II\r\n"..
"------------------------------------------------------------------------------------------\r\n"..
":::::::::::::::::::::::::::Please change you're nick and reconnect:::::::::::::::::::::::::::::::::\r\n"..
"------------------------------------------------------------------------------------------\r\n"
user:SendPM(Bot,Msg)
else
user:SendData(Bot,"The upload prefix you choose is not in the table, please contact an op and inform them of your upload prefix")
end
else
user:SendData(Bot,"Syntax is !" ..cmd.. " <upload> <passowrd>")
end
end
end,
["addul"] = function(user,data)
if user.bOperator then
local s,e,ul = string.find(data,"%b<>%s+%S+%s+(%S+)")
for i,tUl in ipairs(Uploads) do
if tUl == ul then
InTable = 1
end
end
if InTable then
user:SendData(Bot, "Allready in table")
else
Uploads[table.maxn(Uploads) + 1] = ul
SaveToFile("Uploads.dat",Uploads,"Uploads")
LoadFromFile("Uploads.dat")
user:SendData(Bot,ul.. " added to table")
end
end
end,
["delul"] = function(user,data)
if user.bOperator then
local s,e,ul = string.find(data,"%b<>%s+%S+%s+(%S+)")
for i,tUl in ipairs(Uploads) do
if tUl == ul then
InTable = 1
I = i
end
end
if InTable then
Uploads[I] = nil
SaveToFile("Uploads.dat",Uploads,"Uploads")
LoadFromFile("Uploads.dat")
user:SendData(Bot,ul.. " removed from table")
else
user:SendData(Bot, "Not in table")
end
end
end,
}
if tCmds[cmd] then
return tCmds[cmd](user,data),1
end
end
end

-- Serialize by nErBoS
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in pairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
local handle = io.open(file,"w+")
handle:write(Serialize(table, tablename))
handle:flush()
handle:close()
end

function LoadFromFile(filename)
local f = io.open(filename)
if f then
local r = f:read("*a")
f:flush()
f:close()
local func,err = loadstring(r)
if func then x,err = pcall(func) end
end
end


All upload prefixes wil be saved in Uploads.dat
Title: Re: A self register script with custom profile ..
Post by: DynamiteN on 06 July, 2007, 16:57:07
Thx so much ...
it's works perfect..
:-*