Getting a nil value from AddRegUser(user)
 

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

Getting a nil value from AddRegUser(user)

Started by kepp, 13 November, 2003, 17:30:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kepp

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

Guarding    

kepp

Or shall i remove the line SendPM
and don't use

if newuser ~= nil then ??
Guarding    

((UKSN))shad_dow

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 , :)
creator of Therapy-X? bot

kepp

he he :)

I solved it along time ago... Keep going and have fun learning.. :)
Guarding    

NightLitch

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. :-)
//NL

kepp

I suppose that was it... he he, I don't remember... :D
Guarding    

((UKSN))shad_dow

#6

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 ???
 ?(  ?(  ?(  ?(  ?(
creator of Therapy-X? bot

kepp

#7
well, In the manual it says "DelRegUser(NickName)"
You are sending
:D
Guarding    

pHaTTy

the original ~= is like if not user == nil
Resistance is futile!

SMF spam blocked by CleanTalk