PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Krysalis on 27 June, 2005, 10:46:17

Title: Getpass
Post by: Krysalis on 27 June, 2005, 10:46:17
Hello

Im Searching for a LUA 5 Stand Alone Script for getting passwort from User.

Maybe is possible with a profile table where i can enable/Disable this cmd for each Profile.

Found an old Lua 4 One, but theres no Profile check. Only OPs can user +getpass nick.

I have more Profiles which should can use this.

Thx in Advance.

Greets
Title:
Post by: jiten on 27 June, 2005, 11:50:55
Give this a try:
--/---------------------------------------------
-- Get Password v1.0 by jiten (6/27/2005)
--/---------------------------------------------

sBot = frmHub:GetHubBotName()
tPrefixes = {}
AllowedProfiles = {
[-1] = 0, -- unreg
[0] = 1, -- master
[1] = 1, -- operator
[2] = 0, -- vip
[3] = 0, -- reg
[4] = 1, -- moderator
[5] = 1, -- founder
}

Main = function()
for a,b in pairs(frmHub:GetPrefixes()) do tPrefixes[b] = 1 end
end

ChatArrival = function(user,data)
local data = string.sub(data,1,-2)
local s,e,sPrefix,cmd = string.find(data,"%b<>%s*(%S)(%S+)")
if sPrefix and tPrefixes[sPrefix] then
local tCmds = {
["getpass"] =
function(user,data)
if AllowedProfiles[user.iProfile] == 1 then
local s,e,nick = string.find(data,"%b<>%s+%S+%s+(%S+)")
if nick then
if frmHub:GetUserPassword(nick) then
user:SendData(sBot,"Nick: "..nick..", Password: "..frmHub:GetUserPassword(nick))
else
user:SendData(sBot,"*** Error: "..nick.." isn't registered.")
end
else
user:SendData(sBot,"*** Syntax Error: Type !getpass ")
end
else
user:SendData(sBot,"*** Error: You are not allowed to use this command.")
end
end,
}
if tCmds[cmd] then return tCmds[cmd](user,data),1 end
end
end

*edit* Missing If Added
Best regards
Title:
Post by: Krysalis on 27 June, 2005, 11:57:15
Thx M8,

Looks Great. I will test it today evening at Home.

Greets
Title:
Post by: Krysalis on 27 June, 2005, 12:06:17
why i can change to use more prefixes?

So that i can use
!getpass nick
+getpass Nick
#getpass nick

Is it much to do? I asked, because i like to have by all my scripts this 3 Prefixes ;-)

Greets
Title:
Post by: jiten on 27 June, 2005, 12:13:56
QuoteOriginally posted by Krysalis
why i can change to use more prefixes?

So that i can use
!getpass nick
+getpass Nick
#getpass nick

Is it much to do? I asked, because i like to have by all my scripts this 3 Prefixes ;-)

Greets
Well, in the PtokaX's GUI, go to the Options tab and add them to the "Hub commands prefix" box.

Best regards
Title:
Post by: Krysalis on 27 June, 2005, 12:22:40
Thats all?

but i think it works only if there is no prefix specified in the script itself....or am i wrong?

Greets
Title:
Post by: Dessamator on 27 June, 2005, 14:39:10
yep, it depends on the script,
Title:
Post by: jiten on 27 June, 2005, 15:30:29
QuoteOriginally posted by Krysalis
Thats all?

but i think it works only if there is no prefix specified in the script itself....or am i wrong?

Greets
Indeed. That's all (just like Dessamator said)  :D

Cheers
Title:
Post by: Krysalis on 27 June, 2005, 20:26:51
oki, understood ;-)

Thx