Help me plz to convert the script to lua 5.1 :)
 

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

Help me plz to convert the script to lua 5.1 :)

Started by electronic_Psycho, 24 July, 2006, 16:02:39

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

electronic_Psycho

Hello ppl ?;D

i need help plz to convert the script to lua 5.1 ..

****
its work with 5.1 but the problem its all the time give me other mistake.. [sorry on my bad english!]
i hope that someon can helo me with that.. ?::)
tnx! ?:-*

electronic_Psycho

#1
hi again,,? ;D

sorry to distub? ????

i have 1 mor script that i need help with convert to lua 5.1 . is some on can help.. tnx a loot!? ;)
***
------------------------------------------------------------------------------------------------
----//? ?Loggin by TiMeTrAVelleR Fixed By Optimus //-----------------
----------------------------- Converted to Lua 5 by jiten------------------------
----//? Mor status & edit by: ElecTronic??.Psycho! //----------------
------------------------------------------------------------------------------------------------
----// Set here your bot name

sBotName = ".???iN-System???." 

kb = 1024 
mb = kb*kb 
gb = kb*kb*kb
tb = kb*kb*kb*kb 

function NewUserConnected(user) 
	Message(user) 
end 

function OpConnected(user) 
	Message(user) 
end 

--// Profile Counter 
function ProfileCounter(profile) 
	local table, count = GetUsersByProfile(profile), 0 
	for i, User in table do 
		if GetItemByName(User) then 
			count = count + 1 
		end 
	end 
	return count 
end 

function Message(user) 
	if user.sMyInfoString then 
	local disp = "" 
		doGetProfile = GetProfileName(user.iProfile) or "Not registerd" 
		hubshare = string.format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024)/(1024)) 
		local _,_,share = string.find(user.sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" ) 
		if share then 
			minshare = string.format("%0.2f", tonumber(share)/gb).." GB" 
		else 
			minshare = "Corrupt" 
		end 
	end

border1 = "1"
border2 = "2"
disp = "\r\n\r\n"..border1.."\r\n"

disp = disp.." 02\r\n"

disp = disp.." 03\r\n"

disp = disp.." 04\r\n"

disp = disp.." 05\r\n"

disp = disp.." 06\r\n"

disp = disp.." 07\r\n"

disp = disp.." 08\r\n"
disp = disp.." 09"\r\n"

disp = disp.." 10 "..doGetProfile .."\r\n"

disp = disp.." 11 "..user.sIP.."\r\n"
disp = disp.." 12 "..minshare.."\r\n"
disp = disp.." 13\r\n"
disp = disp.." 14\r\n"

disp = disp.." 15 ".. hubshare.." TiB\r\n"

disp = disp.." 16 "..frmHub: GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online. .\r\n"
disp = disp.." 17 "..ProfileCounter("Netfounder").." [Hub-oWner] - "..ProfileCounter("Master").." [Master's] - "..ProfileCounter ("Operator").." [oP's] - "..ProfileCounter("Moderator").." [-S-Vip's] - "..ProfileCounter("Vip").." [Vip's] - "..ProfileCounter("reg").." [reg's] \r\n"

disp = disp.." 18 "..frmHub: GetHubDescr().."\r\n"

disp = disp.." 19 \r\n"..border2.."\r\n"

	user:SendData(sBotName, disp)

end

jiten

Quote from: electronic_Psycho on 24 July, 2006, 16:02:39
Hello ppl ?;D

i need help plz to convert the script to lua 5.1 ..

****
its work with 5.1 but the problem its all the time give me other mistake.. [sorry on my bad english!]
i hope that someon can helo me with that.. ?::)
tnx! ?:-*

What about using the latest bastya_elvtars' FreshStuff?

If not, try Mutor's '50to51' converter.

electronic_Psycho

hi jiten .. good evening!  :)

tnx u for replay!!

i try to use with "50to51"

but not work for me :(  [some eror i get]

& i see new version of this script & the true.. i dont like the look of them.. :(

i want this script.. i try myself do it before i post it in the forum.. but.. nit succses on my side.

plz help with script...  :'(

the eror i get is "Release Bot.lua:520: attempt to call a table value"

& the other script "login in"

dont work at all... plz some on help me...

tnx!!  :-X

electric_sycho ;)

jiten

If that's so, in lines 520 and 536, replace:

for i,v in _table do


with:

for i,v in pairs(_table) do


The same goes for line 457.

electronic_Psycho

tnx you very much jiten!!!  :-*

my release bot work.. tnx u!!

i try to do the same in my "login in" script .. lol

but now i got this eror "Online-C.lua:26: bad argument #1 to 'pairs' (table expected, got nil)"

***
--// Profile Counter
function ProfileCounter(profile)
   local table, count = GetUsersByProfile(profile), 0
   for i, User in table do
      if GetItemByName(User) then
         count = count + 1
      end
   end
   return count
end
***
i think that is be the same but like u see dont work... plz help  :-[

tnx allot

Markitos

Quote from: electronic_Psycho on 24 July, 2006, 18:36:36
i think that is be the same
It's the same way. Use your head otherwise someone will help you

jiten

Quote from: electronic_Psycho on 24 July, 2006, 18:36:36
but now i got this eror "Online-C.lua:26: bad argument #1 to 'pairs' (table expected, got nil)"
i think that is be the same but like u see dont work... plz help? :-[

Well, the profile names in your code aren't correct:

disp = disp.." 17 "..ProfileCounter("Netfounder").." [Hub-oWner] - "..ProfileCounter("Master").." [Master's] - "..ProfileCounter ("Operator").." [oP's] - "..ProfileCounter("Moderator").." [-S-Vip's] - "..ProfileCounter("Vip").." [Vip's] - "..ProfileCounter("reg").." [reg's] \r\n"


They are case-sensitive.
For more details, have a look at Profiles.xml under your \cfg folder.

Therefore, you must change the existing [and incorrect] entries to NetFounder, VIP and Reg.

electronic_Psycho

tnx u jiten & tnx you Markitos !   :)

i try do all.. but all the time i got the eror..

i try reflace to original names like in Profiles.xml .. but the same..

"scripts\Online-C.lua:26: bad argument #1 to 'pairs' (table expected, got nil)"

  :-\

u can help plz ? i dunnu how ::)

Markitos

Another great way to use the lenght operator. [How i'm stupid, damit!]

electronic_Psycho

 ;D
Tnx You Very Much.. Mutor Jiten Markitos  :-*
work good !!
i try to do what u say jiten but.. i dunno .. the same eror..
when i removed the line
**
disp = disp.." 17 "..ProfileCounter("Netfounder").." [Hub-oWner] - "..ProfileCounter("Master").." [Master's] - "..ProfileCounter ("Operator").." [oP's] - "..ProfileCounter("Moderator").." [-S-Vip's] - "..ProfileCounter("Vip").." [Vip's] - "..ProfileCounter("reg").." [reg's] \r\n"

**
the script work all is good..

"Netfounder" "reg"  "Vip"

itry change them to like in profiles.xml
but nothing..
the same eror..

now tnx to mutor.. i can use it :D

tnx allot!  :D

electronic_Psycho

hi ..  ;D

i need help with that plz

"for key, value in tTable do"   
line 457

some on can tall me what to do plz..

i try byself but.. i dunno how.. ???

plz help.. tnx ;)

6Marilyn6Manson6

Change:

for key, value in tTable do


whit:

for key, value in pairs(tTable) do

electronic_Psycho

#13
hi Mutor.. :)

i do read i reflace the line with the new' that u give me..

but then i gor eror so i think that not like this its need be..? :-[

i got this eror**

Release Bot.lua:457: bad argument #1 to 'pairs' (table expected, got nil)

**
-----------
function Serialize(tTable, sTableName, hFile, sTab)
	sTab = sTab or "";
	hFile:write(sTab..sTableName.." = {\n" );
	for i,v in pairs(_table) do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			Serialize(value, sKey, hFile, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			hFile:write(sTab.."\t"..sKey.." = "..sValue);
		end
		hFile:write(",\n");
	end
	hFile:write(sTab.."}");
end

--------------------

i do it wrong ?? ???

tnx? :)

electronic_Psycho

 ;D ..
i dont see what 6Marilyn6Manson6 write before..

tnx u 6Marilyn6Manson6 tnx u mutor.. tnx all  :-*

its w o r k..

tnx

electronic_Psycho

hi again  ;D

sorry to disrtub u all..

what line shuld be if i have this line "for _,Nick in frmHub:GetOnlineUsers() do"

its a clon bot . i got this eror.. "Clone Alert.lua:39: attempt to call a table value"

if someon can help tnx allot  :)

electronic_Psycho

Morning ppl..  :o

i want ask mutor something,, i dont c it before  ???

"There are : 1 [Hub-oWner] - 5 [Master's] - 18 [oP's] - 67 [-S-Vip's] - 74 [Vip's] - 126 [reg's] online .  . . "

its can be that the script show all the reg users by profile ' but not who is realy online ?

***
--// Profile Counter
function ProfileCounter(profile)
   local count = 0
   if GetUsersByProfile(profile)then
      count = #GetUsersByProfile(profile)
   end
   return count
end
***
this the problem line i think..

u can help me plz to fix that the script show who is online & not show all the reg users by profile?

i sorry.. i dont good scripter  ::)

tnx

Markitos

Quote from: electronic_Psycho on 27 July, 2006, 00:14:54
Quote from: Mutor on 26 July, 2006, 19:54:40
Dont be afraid to read  :P
what line shuld be if i have this line "for _,Nick in frmHub:GetOnlineUsers() do"


Quote from: electronic_Psycho on 27 July, 2006, 05:03:20
its can be that the script show all the reg users by profile ' but not who is realy online ?
It's true maybe this does the trick
--// Profile Counter by Mutor
function cProfile(what)
	local disp = ""
	local table,online,offline,count = GetUsersByProfile(what),0,0,0
	for i, User in pairs(table) do
		count = #GetUsersByProfile(what)
		if GetItemByName(User) then
			online = online + 1
		else
			offline = offline + 1
		end
	end
	disp = disp.."Total: "..count.."\tOnline: "..online.."\tOffline: "..offline
	return disp
end

electronic_Psycho

Hi Markitos  ;)

tnx u very Much!!  :D

i found it  ;D

***
--// Profile Counter     
function ProfileCounter(profile)   
      local table, count = GetUsersByProfile(profile),0
      for i,User in pairs(table) d
      if GetItemByName(User) then
       count = count + 1
       end
     end
     return count
end
***
:) tnx

Markitos


SMF spam blocked by CleanTalk