I need help with this script
 

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

I need help with this script

Started by [BR]Luso, 14 November, 2003, 23:47:21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[BR]Luso

Hi there, i'm having a problem with this scripts, when a user connect to the hub, i have this error --> "Syntax Error: attempt to concat a nil value" but it's not always, just some users on-connect, it's strange.. i tried to see if it was by those fakers without a tag.. but it's not, i have operators joinning in with that syntax error.



Bot 
"[operserv]" 

--frmHub:RegBot(Bot


function 
NewUserConnected(userdata
   
s,e,description,speed,email,share strfind(user.sMyInfoString"$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)"
   
share share / (1024*1024*1024
   
share strsub(share15
   
hubshare frmHub:GetCurrentShareAmount() / (1024*1024*1024) + share 
   hubshare 
strsub(hubshare15
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
   
user:SendData(Bot"
	
? -=[:: "
..user.sName.." ::]=-"
   
user:SendData(Bot"
	
? Host: "
..tohostname(user.sIP)..", IP: " ..user.sIP
   
user:SendData(Bot"
	
? Bem vindo ao "
..frmHub:GetHubName().."."
   
user:SendData(Bot"
	
? Seu status no Hub: "
..(GetProfileName(user.iProfile) or "N?o registrado")) 
   
user:SendData(Bot"
	
? Voc? est? compartilhando "
..share.." GB."
   
user:SendData(Bot"
	
? Usu?rios Online: "
..frmHub:GetUsersCount().."."
   
user:SendData(Bot"
	
? Compartilhamento atual no Hub: "
..hubshare.." GB."
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
end 

function OpConnected(userdata
   
s,e,description,speed,email,share strfind(user.sMyInfoString"$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)"
   
share share / (1024*1024*1024
   
share strsub(share15
   
hubshare frmHub:GetCurrentShareAmount() / (1024*1024*1024) + share 
   hubshare 
strsub(hubshare15
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
   
user:SendData(Bot"
	
? -=[:: "
..user.sName.." ::]=-"
   
user:SendData(Bot"
	
? Host: "
..tohostname(user.sIP)..", IP: " ..user.sIP
   
user:SendData(Bot"
	
? Bem vindo ao "
..frmHub:GetHubName().."."
   
user:SendData(Bot"
	
? Seu status no Hub: "
..(GetProfileName(user.iProfile) or "N?o registrado")) 
   
user:SendData(Bot"
	
? Voc? est? compartilhando "
..share.." GB."
   
user:SendData(Bot"
	
? Usu?rios Online: "
..frmHub:GetUsersCount().."."
   
user:SendData(Bot"
	
? Compartilhamento atual no Hub: "
..hubshare.." GB."
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
end



Another script, I'm using a script called "recordbotv0.952" for hub share and user record, but sometimes he get HUGE share amount on the hub and save it like "8321463217.17 GB." and then stays forever that amount.. hehehe, could be this a problem with the users DC Client ? don't know how to solve this problems :(

Tks in advance for all scripters :)
sorry the english.
Hub Owner - dchub://nacional-no-ip.com


S
? \"aqueles\" que t?m <paci?ncia> para fazer \"coisas\" simples com (perfei??o) ? que ir?o adquirir [habilidade] para fazer coisas dif?ceis com (facilidade).

NightLitch

I see no problem in your script... and I get no error's with it... dunno what wrong... what other script's are
you using but this and recordbot`???


Here my "tiny" face lift on the script hehe, Bored so...  :D

--// Face lift by NightLitch, hehe
Bot = "[operserv]" 

function Main()
--frmHub:RegBot(Bot) 
end

function NewUserConnected(user, data) 
   LoginMessage(user,data)
end 

function OpConnected(user, data) 
   LoginMessage(user,data)
end

function LoginMessage(user,data)
   s,e,description,speed,email,share = strfind(user.sMyInfoString, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)") 
   share = share / (1024*1024*1024) 
   share = strsub(share, 1, 5) 
   hubshare = frmHub:GetCurrentShareAmount() / (1024*1024*1024) + share 
   hubshare = strsub(hubshare, 1, 5) 
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
   user:SendData(Bot, "    ? -=[:: "..user.sName.." ::]=-") 
   user:SendData(Bot, "    ? Host: "..tohostname(user.sIP)..", IP: " ..user.sIP) 
   user:SendData(Bot, "    ? Bem vindo ao "..frmHub:GetHubName()..".") 
   user:SendData(Bot, "    ? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado")) 
   user:SendData(Bot, "    ? Voc? est? compartilhando "..share.." GB.") 
   user:SendData(Bot, "    ? Usu?rios Online: "..frmHub:GetUsersCount()..".") 
   user:SendData(Bot, "    ? Compartilhamento atual no Hub: "..hubshare.." GB.") 
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
end

/NL
//NL

plop

if your bored then do your facelift on this 1.  lol
Bot = "[operserv]" 

--frmHub:RegBot(Bot) 


function NewUserConnected(user) 
   local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
   share = format("%0.2f", ( share / (1024*1024*1024) ))
   local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024) ))
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
   user:SendData(Bot, "    ? -=[:: "..user.sName.." ::]=-") 
   user:SendData(Bot, "    ? Host: "..tohostname(user.sIP)..", IP: " ..user.sIP) 
   user:SendData(Bot, "    ? Bem vindo ao "..frmHub:GetHubName()..".") 
   user:SendData(Bot, "    ? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado")) 
   user:SendData(Bot, "    ? Voc? est? compartilhando "..share.." GB.") 
   user:SendData(Bot, "    ? Usu?rios Online: "..frmHub:GetUsersCount()..".") 
   user:SendData(Bot, "    ? Compartilhamento atual no Hub: "..hubshare.." GB.") 
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
end 

function OpConnected(user) 
   local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
   share = format("%0.2f", (share / (1024*1024*1024)))
   local hubshare = format("%0.2f", (frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
   user:SendData(Bot, "    ? -=[:: "..user.sName.." ::]=-") 
   user:SendData(Bot, "    ? Host: "..tohostname(user.sIP)..", IP: " ..user.sIP) 
   user:SendData(Bot, "    ? Bem vindo ao "..frmHub:GetHubName()..".") 
   user:SendData(Bot, "    ? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado")) 
   user:SendData(Bot, "    ? Voc? est? compartilhando "..share.." GB.") 
   user:SendData(Bot, "    ? Usu?rios Online: "..frmHub:GetUsersCount()..".") 
   user:SendData(Bot, "    ? Compartilhamento atual no Hub: "..hubshare.." GB.") 
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
end
removed some not used stuff and optimized it a little.
hope it works now.
the share size problem should be fixed for sure now.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

tezlo

not all IPs can be resolved so tohostname() will occaonally return nil.. you could do this
user:SendData(Bot, "    ? Host: "..(tohostname(user.sIP) or "n/a")..", IP: " ..user.sIP)

plop

QuoteOriginally posted by tezlo
not all IPs can be resolved so tohostname() will occaonally return nil.. you could do this
user:SendData(Bot, "    ? Host: "..(tohostname(user.sIP) or "n/a")..", IP: " ..user.sIP)
thx didn't see that 1.
this 1 is fixed and facelifted.  lol
Bot = "[operserv]" 

--frmHub:RegBot(Bot) 


function NewUserConnected(user) 
   ShowWelcome(user)
end 

function OpConnected(user) 
   ShowWelcome(user)
end

function ShowWelcome(user)
   local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
   share = format("%0.2f", ( share / (1024*1024*1024) ))
   local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024) ))
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
   user:SendData(Bot, "    ? -=[:: "..user.sName.." ::]=-") 
   user:SendData(Bot, "    ? Host: "..(tohostname(user.sIP) or "n/a")..", IP: " ..user.sIP) 
   user:SendData(Bot, "    ? Bem vindo ao "..frmHub:GetHubName()..".") 
   user:SendData(Bot, "    ? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado")) 
   user:SendData(Bot, "    ? Voc? est? compartilhando "..share.." GB.") 
   user:SendData(Bot, "    ? Usu?rios Online: "..frmHub:GetUsersCount()..".") 
   user:SendData(Bot, "    ? Compartilhamento atual no Hub: "..hubshare.." GB.") 
   user:SendData(Bot, ":p2p:--------------------------------------------------------------------------------------------:p2p:") 
end
 
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

NightLitch

hehe Lol... must have been tired when looking at the code... haha...

well the facelift was a good start, thx for the nice
styles plop... I can really see it coming now...

Hair, mustach hehe...

/NL
//NL

turkiye


[BR]Luso

WoW, Thank U all for help fixing the scripts !! :) work great now..

i wonder if it's possible to include the funtion CountOPs() in the scripts, and vips also, hehe.. :-)

Tks all  :D
Hub Owner - dchub://nacional-no-ip.com


S
? \"aqueles\" que t?m <paci?ncia> para fazer \"coisas\" simples com (perfei??o) ? que ir?o adquirir [habilidade] para fazer coisas dif?ceis com (facilidade).

plop

QuoteOriginally posted by
Luso

WoW, Thank U all for help fixing the scripts !! :) work great now..
i wonder if it's possible to include the funtion CountOPs() in the scripts, and vips also, hehe.. :-)
Tks all  :D
np, here it is, just you have 2 translate it yourself.  lol
now with mustache and nose job.
when you add a vip you need 2 reload them.
-- original by .... (fill in your name here if it was yours)
-- facelift idea's by nightlitch and plop
-- counting online op's/vip's by plop
-- nose job, mustache by plop
-- thx 2 tezlo for the fix of tohostname
-- greets 2 all users/scripters on the lua forum
-- works on 0.3.2.6+ (testdrive+)

Bot = "[operserv]" 
OnlineOPs = {}
VipsTable = {}
OnlineVIPs = {}
-- reload vips command
RELOAD = "!reloadvips"

function Clear() 
   collectgarbage() 
   flush() 
end

function ShowWelcome(user)
   local info = "\r\n\r\n"
   local s,e,share = strfind(user.sMyInfoString, "$(%d+)%$")
   share = format("%0.2f", ( share / (1024*1024*1024) ))
   local hubshare = format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024) ))
   info = info..":p2p:--------------------------------------------------------------------------------------------:p2p:\r\n"
   info = info.."\t? -=[:: "..user.sName.." ::]=-\r\n"
   info = info.."\t? Host: "..(tohostname(user.sIP) or "n/a")..", IP: " ..user.sIP.."\r\n"
   info = info.."\t? Bem vindo ao "..frmHub:GetHubName()..".\r\n"
   info = info.."\t? Seu status no Hub: "..(GetProfileName(user.iProfile) or "N?o registrado").."\r\n"
   info = info.."\t? Voc? est? compartilhando "..share.." GB.\r\n"
   info = info.."\t? Usu?rios Online: "..frmHub:GetUsersCount()..".\r\n"
   info = info.."\t? There are "..getn(OnlineOPs).." Operators and "..getn(OnlineVIPs).." VIP's online.\r\n"
   info = info.."\t? Compartilhamento atual no Hub: "..hubshare.." GB.\r\n"
   info = info..":p2p:--------------------------------------------------------------------------------------------:p2p:\r\n"
   user:SendData(Bot, info.." |")
   Clear()
end

function OpenRegisterdUsersFile()
   readfrom("../RegisteredUsers.dat")
   VipsTable = nil
   Clear()
   VipsTable = {}
   while 1 do
      local line = read()
      local name, level 
      if line == nil then 
         readfrom()
         break 
      end
      s,e,name,level = strfind(line,"(.+)|.+|(.+)")
      if tonumber(level) == 2 then
         VipsTable[name] = 1
      end
   end   
end

function Main()
--frmHub:RegBot(Bot) 
   OpenRegisterdUsersFile()
end

function NewUserConnected(user) 
   if VipsTable[user.sName] then
      tinsert(OnlineVIPs, user.sName)
   end
   ShowWelcome(user)
end 

function UserDisconnected(user)
   if VipsTable[user.sName] then
      for i=1, getn(OnlineVIPs) do
         if OnlineVIPs[i] then
            tremove(OnlineVIPs, i)
            break
         end
      end
   end
end

function OpConnected(user) 
   tinsert(OnlineOPs, user.sName)
   ShowWelcome(user)
end

function OpDisconnected(user)
   for i=1,getn(OnlineOPs) do
      if OnlineOPs[i] == user.sName then
         tremove(OnlineOPs, i)
         break
      end
   end
end

function DataArrival(user, data) 
   if( strsub(data, 1, 1) == "<" ) and user.bOperator then 
      data=strsub(data,1,strlen(data)-1) 
      s,e,cmd = strfind(data,"%b<>%s+(%S+)") 
      user:SendData(Bot, cmd)
      if cmd == RELOAD then
         OpenRegisterdUsersFile()
         user:SendData(Bot, "VIPs reloaded|")
         return 1
      end
   end
end
plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

[BR]Luso

#9
Looking Great Plop, tks for fast replay !! could u make that code on this one ? becouse i'm using another script with the same format..



-- original by nErBoS
-- modified by Varetas and [BR]Luso
-- facelift ideas by nightlitch and plop
-- counting online ops/vips by plop
-- nose jobmustache by plop
-- thx 2 tezlo for the fix of tohostname
-- greets 2 all users/scripters on the lua forum
-- works on 0.3.2.6+ (testdrive+)

Bot "[operserv]" 

--frmHub:RegBot(Bot


function 
NewUserConnected(user
   
local s,e,share strfind(user.sMyInfoString"$(%d+)%$")
   
share format("%0.2f", ( share / (1024*1024*1024) ))
   
local hubshare format("%0.2f",  ( frmHub:GetCurrentShareAmount() / (1024*1024*1024) ))
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
   
user:SendData(Bot"
	
? -=[:: "
..user.sName.." ::]=-"
   
user:SendData(Bot"
	
? Host: "
..(tohostname(user.sIP) or "N/A")..", IP: " ..user.sIP
   
user:SendData(Bot"
	
? Bem vindo(a) ao "
..frmHub:GetHubName().."."
   
user:SendData(Bot"
	
? Seu status no Hub: "
..(GetProfileName(user.iProfile) or "N?o registrado")) 
   
user:SendData(Bot"
	
? Voc? est? compartilhando "
..share.." GB."
   
user:SendData(Bot"
	
? Usu?rios Online: "
..frmHub:GetUsersCount().."."
   
user:SendData(Bot"
	
? Compartilhamento atual no Hub: "
..hubshare.." GB."
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
end 

function OpConnected(user
   
local s,e,share strfind(user.sMyInfoString"$(%d+)%$")
   
share format("%0.2f", (share / (1024*1024*1024)))
   
local hubshare format("%0.2f", (frmHub:GetCurrentShareAmount() / (1024*1024*1024)))
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
   
user:SendData(Bot"
	
? -=[:: "
..user.sName.." ::]=-"
   
user:SendData(Bot"
	
? Host: "
..(tohostname(user.sIP) or "N/A")..", IP: " ..user.sIP
   
user:SendData(Bot"
	
? Bem vindo ao "
..frmHub:GetHubName().."."
   
user:SendData(Bot"
	
? Seu status no Hub: "
..(GetProfileName(user.iProfile) or "N?o registrado")) 
   
user:SendData(Bot"
	
? Voc? est? compartilhando "
..share.." GB."
   
user:SendData(Bot"
	
? Usu?rios Online: "
..frmHub:GetUsersCount().."."
   
user:SendData(Bot"
	
? Compartilhamento atual no Hub: "
..hubshare.." GB."
   
user:SendData(Bot":p2p:--------------------------------------------------------------------------------------------:p2p:"
end



CountOps() and vips, i tried but with erros ! :(
Thank U .. the credits on top
Sorry the english..
Hub Owner - dchub://nacional-no-ip.com


S
? \"aqueles\" que t?m <paci?ncia> para fazer \"coisas\" simples com (perfei??o) ? que ir?o adquirir [habilidade] para fazer coisas dif?ceis com (facilidade).

SMF spam blocked by CleanTalk