Getpass
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Getpass

Started by Krysalis, 27 June, 2005, 10:46:17

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Krysalis

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

jiten

#1
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

Krysalis

Thx M8,

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

Greets

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

jiten

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

Krysalis

Thats all?

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

Greets

Dessamator

yep, it depends on the script,
Ignorance is Bliss.

jiten

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

Krysalis

oki, understood ;-)

Thx

SMF spam blocked by CleanTalk