elseif (cmd=="?addreg") or (cmd=="!addreg") or (cmd=="+addreg") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(3)
AddRegUser(newuser, pass, 3)
if newuser ~= nil then
victim:SendPM(BotName, "\r\nYou are now Registered by: "..user.sName.." \r\nYour New Profile: "..ProFile.." \r\nYour password is set to: "..pass.." \r\n\r\nTo Activate your account please Reconnect! And don't forget your password :)")
user:SendData(BotName, "user : "..victim.sName.." Was sucessfully added as a Reg!") return 1
else
user:SendData(BotName, "User is not Online") return 1 end
The code above is just a part of my script..
Im getting a nil value IF the user is Not online when
doing this command.
I did try to change a little bit
elseif (cmd=="?addreg") or (cmd=="!addreg") or (cmd=="+addreg") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(3)
AddRegUser(newuser, pass, 3)
if newuser ~= nil then
victim:SendPM(BotName, "\r\nYou are now Registered by: "..user.sName.." \r\nYour New Profile: "..ProFile.." \r\nYour password is set to: "..pass.." \r\n\r\nTo Activate your account please Reconnect! And don't forget your password :)")
user:SendData(BotName, "user : "..victim.sName.." Was sucessfully added as a Reg!") return 1
else
AddRegUser(newuser, pass, 3)
user:SendData(BotName, "User is not Online, But he/she was added with succes") return 1 end
However, i do belive this will return nil aswell...
Help me out and make comments on what you've changed!
Thanks
Or shall i remove the line SendPM
and don't use
if newuser ~= nil then ??
hello :)
found u code other day so i had a play , basicly to learn lua and i modifed it to this
if (cmd == "!reg") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(3)
AddRegUser(newuser, pass, 3)
user:SendPM(Bot, "\r\nYou are now Registered by: "..user.sName.." \r\nYour New Profile: "..ProFile.." \r\nYour password is set to: "..pass.." \r\n\r\nTo Activate your account please Reconnect! And don't forget your password :)")
else
if newuser ~= nil then
user:SendData(Bot, "User is not Online, But he/she was added with succes") return 1 end
end
use !reg
that was fun to play around with , :)
he he :)
I solved it along time ago... Keep going and have fun learning.. :)
well My guess is you get that nil value when you just type
the command right ???
you need to resolve the newuser if nilled.
ex:
if newuser == nil then
--more code
this is just hints. :-)
I suppose that was it... he he, I don't remember... :D
if (cmd == "!reg") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(3)
AddRegUser(newuser, pass, 3)
user:SendPM(Bot, "\r\nYou are now Registered by: "..user.sName.." \r\nYour New Profile: "..ProFile.." \r\nYour password is set to: "..pass.." \r\n\r\nTo Activate your account please Reconnect! And don't forget your password :)")
else
if newuser ~= nil then
user:SendData(Bot, "User is not Online, But he/she was added with succes") return 1 end
end
kepp and NightLitch
now i have a prob if i change
AddRegUser(newuser, pass, 3) to DelRegUser(newuser)
like below
if (cmd == "!dereg") then
s,e,cmd,newuser,pass = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(.+)")
ProFile = GetProfileName(3)
DelRegUser(newuser, 3)
user:SendPM(Bot, "\r\nYou are now de-Registered by: "..user.sName.." \r\")
else
if newuser ~= nil then
user:SendData(Bot, "User is not Online, But he/she was De-regged with succes")
return 1
end
end
when i do the command nothing happends and ptokax reports no errors ????, am i mising some thing or just not codeing up the right tree here ???
?( ?( ?( ?( ?(
well, In the manual it says "DelRegUser(NickName)"
You are sending
:D
the original ~= is like if not user == nil