--## 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
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
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 ;)
Ofcorse it works, but you are parsing things that are not needed
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
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
--## 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