Author Topic: What I am doing wrong?  (Read 3127 times)

0 Members and 1 Guest are viewing this topic.

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
What I am doing wrong?
« on: 02 March, 2008, 14:45:19 »
Hello it?s me again.

What I doing wrong?  It?s a part of a script what I hope to finish.
Getting error on this line  >>>  name = Core.GetUser(nick,true)
If the rest is oke don?t know yet.
Please some one help me.   ???
Code: [Select]
function OnTimer(tmr)
TmrMan.RemoveTimer(tmr)
for i,v in pairs(Core.GetOnlineUsers(true)) do
local nick = ""
nick = v["sName"]
name = Core.GetUser(nick,true)
user = Core.GetUser(nick,true)
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if name and DeKlos[user.iProfile] == 1 and shareGB < minshareReg then
sUser = Core.GetUser(nick,true)
local kunst = "\t"..string.rep("~",80).."\r\n"
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f GB ",shareGB)
        local Difference = minshareReg - shareGB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..sharem.." does not meet our minimum of "..minshareReg.." GB  for Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."GB  to meet de min share of "..minshareReg.." GB  for Users in this Hub."..   
"\r\n\r\n\tPlease increase your share and return to this nice hub.\t\tYou get now a "..action.."."..
                        "\r\n\r\n"..kunst.."\r\n"
Core.SendToNick(user.sNick,"<"..sBot.."> "..txt)

Respectfully,

[NL]Daddy-Bear?
???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

PtokaX forum

What I am doing wrong?
« on: 02 March, 2008, 14:45:19 »

Offline speedX

  • Lord
  • ***
  • Posts: 437
  • Karma: +59/-19
Re: What I am doing wrong?
« Reply #1 on: 02 March, 2008, 20:00:32 »
I think this line
Quote
nick = v["sName"]

Should be:
Quote
nick = v["sNick"]
Thanking You,

speedX

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
Re: What I am doing wrong?
« Reply #2 on: 02 March, 2008, 22:35:01 »
Hello it?s me again.

 ;) ;) ;)  Thanks speedX for you reply.   ;) ;) ;)
What I doing wrong?  It?s a part of a script what I hope to finish.
Getting now error on this line  >>>  name = Core.GetUser(nick,true)
Px says ?bad argument #1 to 'GetUser' (string expected, got nil)?
I have copy now the whole part of the script up to end.    ???
Code: [Select]
function OnTimer(tmr)
TmrMan.RemoveTimer(tmr)
for i,v in pairs(Core.GetOnlineUsers(true)) do
local nick = ""
nick = v["snick"]  -- v["sName"]
name = Core.GetUser(nick,true)
user = Core.GetUser(nick,true)
local shareMB = user.iShareSize / (1024^2) or 0
local shareGB = user.iShareSize / (1024^3) or 0
if name and DeKlos[user.iProfile] == 1 and shareGB < minshareReg then
sUser = Core.GetUser(nick,true)
local kunst = "\t"..string.rep("~",80).."\r\n"
local share = string.format(" %.2f MB ",shareMB)
local sharem = string.format(" %.2f GB ",shareGB)
        local Difference = minshareReg - shareGB
local txt = "\r\n\r\n"..kunst..""..
                        "\r\n\tYour current share of "..sharem.." does not meet our minimum of "..minshareReg.." GB  for Users."..   
"\r\n\r\n\tYou will have to increase your share with "..string.format(" %.2f ", Difference).."GB  to meet de min share of "..minshareReg.." GB  for Users in this Hub."..   
"\r\n\r\n\tPlease increase your share and return to this nice hub.\t\tYou get now a "..action.."."..
                        "\r\n\r\n"..kunst.."\r\n"
Core.SendToNick(user.sNick,"<"..sBot.."> "..txt)
redictstart = redictstart + 1
memgebruik = collectgarbage(count)
local msg1="\r\n\r\n\t\t\t\t\t*Lua Aktie's*\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1 = msg1.."\t       User   "..user.sNick.."\t   Wass getting this action:    "..action.."\tTotal actions so far "..redictstart.."\r\n"
msg1 = msg1.."\t\t\t\tThe lua is started on "..opstart.."\r\n"
msg1 = msg1.."\t\t\t\tMemory use at this moment "..memgebruik.." Kb\r\n"
        msg1 = msg1.."\t================================================================================\r\n"
msg1=msg1.."\r\n"
k = k + 1
if k == kk then Core.SendPmToNick(Nick,bot,msg1)
-- SendPmToNick(Nick,bot,msg1)
-- SendPmToOps(bot,msg1)
if act == 1 then Core.TempBan(sUser,bantyd,"","",0) end
if act == 2 then snick:Redirect(redicthub) end
-- if act == 2 then sUser:Redirect(redicthub) end
if act == 3 then Core.Disconnect(sUser) end
if k == kk then k = 0 end
end
end
 end
collectgarbage(collect)
tmr = TmrMan.AddTimer(Min*klik)
end
 

Respectfully,

[NL]Daddy-Bear?

???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
Re: What I am doing wrong?
« Reply #3 on: 03 March, 2008, 14:45:04 »
Hello it?s me again.

Thanks American Idiot for your reply.  ;) ;)
Its running better now, only this part still does end work get no actions taken on user.
Note: no errors from Px.
 
Code: [Select]
if act == 1 then Core.TempBan(sUser,bantyd,"","",0) end
if act == 2 then snick:Redirect(redicthub) end
-- if act == 2 then sUser:Redirect(redicthub) end
if act == 3 then Core.Disconnect(nick) end
if k == kk then k = 0 end
end
end
 end
collectgarbage(collect)
tmr = TmrMan.AddTimer(Min*klik)
end
 

Note >>  if act == 3 then Core.Disconnect(nick) end is Working
             if act == 2  gifs error     attempt to call method 'Redirect' (a nil value)

Respectfully,

[NL]Daddy-Bear?
« Last Edit: 03 March, 2008, 16:47:09 by [NL]Daddy-Bear? »
???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

Offline speedX

  • Lord
  • ***
  • Posts: 437
  • Karma: +59/-19
Re: What I am doing wrong?
« Reply #4 on: 03 March, 2008, 16:45:23 »
Its BanMan.TempBan and not Core.TempBan
Also it is Core.Redirect and not user:Redirect

You are still using old API codes, for more info please read the new scripting-interface of 0.4.0.0
Thanking You,

speedX

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
Re: What I am doing wrong?
« Reply #5 on: 03 March, 2008, 18:40:56 »
Hello it?s me again.

speedX  first    ???????????? Lets enjoy our Hobby ??????????  !!!!!!   ;)
Commands works not for me try them all in the script Px don?t like it.
And where can the new scripting-interface of 0.4.0.0 be found?

Respectfully,

[NL]Daddy-Bear?
???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

Offline Tw?sT?d-d?v

  • Lord
  • ***
  • Posts: 436
  • Karma: +79/-2
    • EURO-OP
Re: What I am doing wrong?
« Reply #6 on: 03 March, 2008, 21:34:14 »
In the Scripting.docs folder that comes with PtokaX

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
Re: What I am doing wrong?
« Reply #7 on: 04 March, 2008, 15:55:01 »
Hello it?s me again.

Thanks Tw?sT?d-d?v?l  for your reply.   :)
That was just what I needed.
Lua is running now. After test period shall I post it in Finished Scripts section.  ;D

Thanks all for reply and your help.

Respectfully,

[NL]Daddy-Bear?
???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

Offline [NL]Daddy-Bear?

  • Scripter
  • Double Ace
  • ******
  • Posts: 102
  • Karma: +70/-7
  • ?????? Its me Daddy-Bear? ?????
Re: What I am doing wrong?
« Reply #8 on: 15 March, 2008, 14:06:57 »
Hello it?s me again.

Code: [Select]
After test period I shall post it in Finished Scripts section.http://board.ptokax.ath.cx/index.php?topic=7671.0
Done.

Respectfully,

[NL]Daddy-Bear?
???????????? Lets enjoy our Hobby ??????????

dchub://Daddys-Friends-Association.no-ip.org:4106

take a peek you are welcome :D

PtokaX forum

Re: What I am doing wrong?
« Reply #8 on: 15 March, 2008, 14:06:57 »