Author Topic: Getting a nil value from AddRegUser(user)  (Read 2709 times)

0 Members and 1 Guest are viewing this topic.

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
Getting a nil value from AddRegUser(user)
« on: 13 November, 2003, 17:30:53 »
Code: [Select]
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

Code: [Select]
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    

PtokaX forum

Getting a nil value from AddRegUser(user)
« on: 13 November, 2003, 17:30:53 »

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #1 on: 13 November, 2003, 17:33:25 »
Or shall i remove the line SendPM
and don't use

if newuser ~= nil then ??
Guarding    

Offline ((UKSN))shad_dow

  • Triple Ace
  • **
  • Posts: 213
  • Karma: +2/-0
(No subject)
« Reply #2 on: 28 January, 2004, 20:54:01 »
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

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #3 on: 28 January, 2004, 20:59:17 »
he he :)

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

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #4 on: 28 January, 2004, 21:05:11 »
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

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #5 on: 28 January, 2004, 21:09:16 »
I suppose that was it... he he, I don't remember... :D
Guarding    

Offline ((UKSN))shad_dow

  • Triple Ace
  • **
  • Posts: 213
  • Karma: +2/-0
(No subject)
« Reply #6 on: 29 January, 2004, 00:30:31 »

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 ???
 ?(  ?(  ?(  ?(  ?(
« Last Edit: 29 January, 2004, 00:30:55 by ((UKSN))shad_dow »
creator of Therapy-X? bot

Offline kepp

  • Scripter
  • King
  • ******
  • Posts: 790
  • Karma: +2/-0
(No subject)
« Reply #7 on: 29 January, 2004, 07:16:20 »
well, In the manual it says "DelRegUser(NickName)"
You are sending
:D
« Last Edit: 29 January, 2004, 07:16:33 by kepp »
Guarding    

Offline pHaTTy

  • Forum Legend
  • ***
  • Posts: 1 916
  • Karma: +5/-1
(No subject)
« Reply #8 on: 29 January, 2004, 09:35:58 »
the original ~= is like if not user == nil
Resistance is futile!

PtokaX forum

(No subject)
« Reply #8 on: 29 January, 2004, 09:35:58 »