What I am doing wrong?
 

What I am doing wrong?

Started by [NL]Daddy-Bear?, 02 March, 2008, 14:45:19

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[NL]Daddy-Bear?

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.   ???
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

speedX

I think this line
Quote
nick = v["sName"]

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

speedX

[NL]Daddy-Bear?

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.    ???
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

[NL]Daddy-Bear?

#3
Hello it?s me again.

Thanks Mutor 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.
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?
???????????? Lets enjoy our Hobby ??????????

dchub://daddys-friends-association.no-ip.org:4106

take a peek you are welcome :D

speedX

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

[NL]Daddy-Bear?

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

Tw?sT?d-d?v

In the Scripting.docs folder that comes with PtokaX

[NL]Daddy-Bear?

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

[NL]Daddy-Bear?

Hello it?s me again.

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

SMF spam blocked by CleanTalk