Need Help With convert. someon plz,,,
 

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

Need Help With convert. someon plz,,,

Started by electronic_Psycho, 29 March, 2005, 20:22:30

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

electronic_Psycho

Hello..
i have a problem with this script..
i want 2 convert it 2 lua 5.. someon can help
please..

Code:
-----------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------------
---// Loggin by TiMeTrAVelleR Fixed By Optimus //----------
-----------------------------------------------------------------------------------mor status by: ElecTronic??.Psycho!
------------------------------------------------------------------------------------------------------------------------------

BotName = "bot" --// Set here your bot name

kb = 1024
mb = kb*kb
gb = 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 = format("%0.2f", frmHub:GetCurrentShareAmount()/(1024)/(1024)/(1024))
local _,_,share = strfind(user.sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" )

if share then
minshare = format("%0.2f", tonumber(share)/gb).." GB"
else
minshare = "Corrupt"
end
end

border1 = "       ::?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::"
border2 = "       ::?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.."       - ? - Welcome .. "..user.sName.."\r\n"
disp = disp.."       - ? - Welcome To.. "..frmHub:GetHubName().." ! enjoy.. \r\n"
disp = disp.."       - ? - Your IP is: "..user.sIP.."\r\n"
disp = disp.."       - ? - Your Share is: "..minshare.."\r\n"
disp = disp.."       - ? - Your Status in this Hub is: "..doGetProfile.."\r\n"
disp = disp.."       - ? - Actual Share in the Hub is: "..hubshare.." GB\r\n"
disp = disp.."       - ? - There are: "..ProfileCounter("Master").." [Masters] - "..ProfileCounter("Netfounder").." [S'ops] - "..ProfileCounter("Operator").." [Op'S] - "..ProfileCounter("Moderator").." [S'Vips] - "..ProfileCounter("Vip").." [Vips] - "..ProfileCounter("reg").." [reg]  online\r\n"
disp = disp.."       - ? - There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n"
disp = disp.."       - ? - Hub description is: "..frmHub:GetHubDescr().."\r\n"
disp = disp.."       - ? - Hub MinShare is: - 5 - GB.\r\n"
disp = disp.."       - ? - Hub MinSlots is: - 3 - \r\n"
disp = disp.."       - ? - Redirect address is : "..frmHub:GetRedirectAddress().."\r\n"  
disp = disp.."       - ? - Hub Powerd By: Ruri_Ruri?\r\n"..border2.."\r\n"


user:SendData(BotName, disp)
end

jiten

#1
Try this:

----------------------------------------------------------------------- 
----------------------------------------------------------------------------------------------------------------------------- 
---// Loggin by TiMeTrAVelleR Fixed By Optimus //---------- 
-- Converted to Lua 5 by jiten
-----------------------------------------------------------------------------------mor status by: ElecTronic??.Psycho! 
------------------------------------------------------------------------------------------------------------------------------ 

BotName = "bot" --// Set here your bot name 

kb = 1024 
mb = kb*kb 
gb = 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)) 
		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 

	border = "  ::?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::" 
	disp = "\r\n\r\n"..border.."\r\n" 
	disp = disp.." - ? - Welcome .. "..user.sName.."\r\n" 
	disp = disp.." - ? - Welcome To.. "..frmHub:GetHubName().." ! enjoy.. \r\n" 
	disp = disp.." - ? - Your IP is: "..user.sIP.."\r\n" 
	disp = disp.." - ? - Your Share is: "..minshare.."\r\n" 
	disp = disp.." - ? - Your Status in this Hub is: "..doGetProfile.."\r\n" 
	disp = disp.." - ? - Actual Share in the Hub is: "..hubshare.." GB\r\n" 
	disp = disp.." - ? - There are: "..ProfileCounter("Master").." [Masters] - "..ProfileCounter("Netfounder").." [S'ops] - "..ProfileCounter("Operator").." [Op'S] - "..ProfileCounter("Moderator").." [S'Vips] - "..ProfileCounter("Vip").." [Vips] - "..ProfileCounter("reg").." [reg] online\r\n" 
	disp = disp.." - ? - There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n" 
	disp = disp.." - ? - Hub description is: "..frmHub:GetHubDescr().."\r\n" 
	disp = disp.." - ? - Hub MinShare is: - 5 - GB.\r\n" 
	disp = disp.." - ? - Hub MinSlots is: - 3 - \r\n" 
	disp = disp.." - ? - Redirect address is : "..frmHub:GetRedirectAddress().."\r\n" 
	disp = disp.." - ? - Hub Powerd By: Ruri_Ruri?\r\n"..border.."\r\n" 
	user:SendData(BotName, disp) 
end


Best regards,

jiten

electronic_Psycho

tnx jiten !  ;)

But now i have other problem .. ?(  

-------------------------------
.3.3.0.b16.09\scripts\onlinel05.lua:46: unfinished string near `"  ::?::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'

i try 2 find what is this. but i dont.. :(

i'm a  new 1 in scrits

you can help me please with this "string near" ?

The_Fox

QuoteOriginally posted by electronic_Psycho
tnx jiten !  ;)

But now i have other problem .. ?(  

-------------------------------
.3.3.0.b16.09\scripts\onlinel05.lua:46: unfinished string near `"  ::?::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::'

i try 2 find what is this. but i dont.. :(

i'm a  new 1 in scrits

you can help me please with this "string near" ?

It's quite easy... look in the code and find these lines:
   border1 = "  ::?::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::"
   border2 = "  ::?::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::"

  The strings are incorrectly broken into lines - strings need to be closed in double quotes on each line and multi-line strings have to be concatenated using double dot (..) command... look at your old code and use the lines with border1 and border2 from your old version =)

  Btw. it doesn't make much sense to create two same variables (border1 and border2), but to doesn't do no bad neither, so you can just ignore this last sentence :o)

electronic_Psycho

hello..

Tnx The_Fox  :D

now i have other problem..

 :(  :(

Help please..

eror :
----------------------------------------------
\0.3.3.0.b16.09\scripts\onlinel05.lua:61: attempt to concatenate a nil value

jiten

First post updated  :]

The_Fox

#6
electronic_Psycho: I'll try to reinsert the code as it should be, so you won't have any trouble anymore... I've tested it and it works

----------------------------------------------------------------------- 
----------------------------------------------------------------------------------------------------------------------------- 
---// Loggin by TiMeTrAVelleR Fixed By Optimus //---------- 
-- Converted to Lua 5 by jiten
-----------------------------------------------------------------------------------mor status by: ElecTronic??.Psycho! 
------------------------------------------------------------------------------------------------------------------------------ 

BotName = "bot" --// Set here your bot name 

kb = 1024 
mb = kb*kb 
gb = 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)) 
		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 

	[U]border = "   ::?::::::::::::::::::::::::::::::::::::::::::::::::::?::"[/U]  
	disp = "\r\n\r\n"..border.."\r\n" 
	disp = disp.." - ? - Welcome .. "..user.sName.."\r\n" 
	disp = disp.." - ? - Welcome To.. "..frmHub:GetHubName().." ! enjoy.. \r\n" 
	disp = disp.." - ? - Your IP is: "..user.sIP.."\r\n" 
	disp = disp.." - ? - Your Share is: "..minshare.."\r\n" 
	disp = disp.." - ? - Your Status in this Hub is: "..doGetProfile.."\r\n" 
	disp = disp.." - ? - Actual Share in the Hub is: "..hubshare.." GB\r\n" 
	disp = disp.." - ? - There are: "..ProfileCounter("Master").." [Masters] - "..ProfileCounter("Netfounder").." [S'ops] - "..ProfileCounter("Operator").." [Op'S] - "..ProfileCounter("Moderator").." [S'Vips] - "..ProfileCounter("Vip").." [Vips] - "..ProfileCounter("reg").." [reg] online\r\n" 
	disp = disp.." - ? - There are now: "..frmHub:GetUsersCount().." of "..frmHub:GetMaxUsers().." users Online\r\n" 
	disp = disp.." - ? - Hub description is: "..frmHub:GetHubDescr().."\r\n" 
	disp = disp.." - ? - Hub MinShare is: - 5 - GB.\r\n" 
	disp = disp.." - ? - Hub MinSlots is: - 3 - \r\n" 
	disp = disp.." - ? - Redirect address is : "..frmHub:GetRedirectAddress().."\r\n" 
	disp = disp.." - ? - Hub Powerd By: Ruri_Ruri?\r\n"..border.."\r\n" 
	user:SendData(BotName, disp) 
end

Note: I had to change the string in the line which is underlined, so it wouldn't be broken into lines anymore... this is the original one, you can replace the line:
border = " ::?:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::::::::::::::::::?::"

jiten

Oops, I forgot that by copying all that line here, he would divide it in others, because it was very big.

Yups, it's just like The_Fox said, the trick is to put those 3 lines together.

Cheers.

electronic_Psycho

tnx ..jiten
& tnx The_Fox  

it work now :D

now i heppy ;)

Tnx ..

SMF spam blocked by CleanTalk