PASSWORD CHANGER BOT
 

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

PASSWORD CHANGER BOT

Started by 6Marilyn6Manson6, 06 May, 2005, 14:36:16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

6Marilyn6Manson6

--## PASSWORD CHANGER BOT
--## Request by 6Marilyn6Manson6
--## Made by nErBoS
--## Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
--## Commands:
--##	+changepass 	- Changes your password

sBot = "PC-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function ChatArrival(user, data)
	if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then
		data = string.sub(data,1,string.len(data)-1)
		local s,e,cmd = string.find(data, "%b<>%s+(%S+)")
		if (cmd == "+changepass") then
			local s,e,sPass = string.find(data, "%b<>%s+%S+%s+(%S+)")
			if (sPass == nil) then
				user:SendPM(sBot, "Syntax Error, +changepass , you must write a password.")
			elseif (user.iProfile == -1) then
				user:SendPM(sBot, "You aren't regged, so you don't have a password.")
			elseif (string.find(sPass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (string.find(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser(user.sName,sPass,user.iProfile)
				user:SendPM(sBot, "Your password has been changed to: "..sPass.." . Please recconect to make effect.")
			end
			return 1
		end
	end
end

c ya

jiten

There's no need for this in Lua 5:
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then
The $To part is related to ToArrival so, changing the password in PM won't work while u don't remove that part and add this:
function ToArrival(user, data)
	local s,e,to,from,text = string.find(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
	if to == sBot then
		-- your code
	end
end

Best regards

6Marilyn6Manson6

QuoteOriginally posted by jiten
There's no need for this in Lua 5:
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then
The $To part is related to ToArrival so, changing the password in PM won't work while u don't remove that part and add this:
function ToArrival(user, data)
	local s,e,to,from,text = string.find(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
	if to == sBot then
		-- your code
	end
end

Best regards


Yes... but... work ;)

kepp

Ofcorse it works, but you are parsing things that are not needed
Guarding    

jiten

QuoteOriginally posted by kepp
Ofcorse it works, but you are parsing things that are not needed
Indeed, but, that was just an example, as I just stripped the code and modded it fastly and didn't notice I was parsing unnecessary stuff ;)

Btw Marilyn, in PM it won't.

Cheers

6Marilyn6Manson6

QuoteOriginally posted by jiten
QuoteOriginally posted by kepp
Ofcorse it works, but you are parsing things that are not needed
Indeed, but, that was just an example, as I just stripped the code and modded it fastly and didn't notice I was parsing unnecessary stuff ;)

Btw Marilyn, in PM it won't.

Cheers

I don't have test it in pm :P test now hiihhihi

6Marilyn6Manson6

--## PASSWORD CHANGER BOT
--## Request by 6Marilyn6Manson6
--## Made by nErBoS
--## Converted in LUA 5 by 6Marilyn6Manson6 at 06/05/2005
--## Fixed Bug with ChangePass in PM (tnk Jiten)
--## Commands:
--##	+changepass 	- Changes your password

sBot = "PC-Bot"

function Main()
	frmHub:RegBot(sBot)
end

function ChatArrival(user, data)
		data = string.sub(data,1,string.len(data)-1)
		local s,e,cmd = string.find(data, "%b<>%s+(%S+)")
		if (cmd == "+changepass") then
			local s,e,sPass = string.find(data, "%b<>%s+%S+%s+(%S+)")
			if (sPass == nil) then
				user:SendPM(sBot, "Syntax Error, +changepass , you must write a password.")
			elseif (user.iProfile == -1) then
				user:SendPM(sBot, "You aren't regged, so you don't have a password.")
			elseif (string.find(sPass, "[%c|\n\r]")) then
				user:SendPM(sBot, "Invalid Password. Try Again.")
			elseif (string.find(user.sName, "[%c|\n\r]")) then 
				user:SendPM(sBot, "Your nick is invalid. Please choose a new one.")
			else
				AddRegUser(user.sName,sPass,user.iProfile)
				user:SendPM(sBot, "Your password has been changed to: "..sPass.." . Please recconect to make effect.")
			end
			return 1
	end
end

function ToArrival(user, data)
	local s,e,to,from,text = string.find(data, "%$To:%s(%S+)%sFrom:%s(%S+)%s$(.*)$")
		if to == sBot then
		ChatArrival(user, data)
	end
end

now work in pm hiihihih [tnk jiten ;)] c ya

SMF spam blocked by CleanTalk