function CountOPs()
 

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

function CountOPs()

Started by nEgativE, 25 December, 2003, 10:55:00

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

nEgativE

Hi There.. i'm looking 4 a stand alone function CountOPs() and vips..  :))

Tks in advance.

plop

quick job, hope it works.
ops =0
vips = 0
VIPS = {}
OPS = {}

function NewUserConnected(user) 
   if user.iProfile == 2 then
      CountVips(user)
   end
end

function OpConnected(user) 
   CountOps(user)
end

function DataArrival(user,data) 
   if user.bOperator then
      CountOps(user)
   elseif user.iProfile == 2 then
      CountVips(user)
   end
end

function CountOps(user)
   if OPS[user.sName] == nil then
      OPS[user.sName]=1
      ops = ops + 1
   end
end

function CountVips(user)
   if VIPS[user.sName] == nil then
      VIPS[user.sName]=1
      vips=vips +1
   end
end

function UserDisconnected(user)
   if user.iProfile == 2 then
      if VIPS[user.sName] then
         VIPS[user.sName]=nil
         vips=vips - 1
      end
   end
end

function OpDisconnected(user)
   if OPS[user.sName] then
      OPS[user.sName]=nil
      ops = ops -1
   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 <----<<

nEgativE

QuoteOriginally posted by plop
quick job, hope it works.
ops =0
vips = 0
VIPS = {}
OPS = {}

function NewUserConnected(user) 
   if user.iProfile == 2 then
      CountVips(user)
   end
end

function OpConnected(user) 
   CountOps(user)
end

function DataArrival(user,data) 
   if user.bOperator then
      CountOps(user)
   elseif user.iProfile == 2 then
      CountVips(user)
   end
end

function CountOps(user)
   if OPS[user.sName] == nil then
      OPS[user.sName]=1
      ops = ops + 1
   end
end

function CountVips(user)
   if VIPS[user.sName] == nil then
      VIPS[user.sName]=1
      vips=vips +1
   end
end

function UserDisconnected(user)
   if user.iProfile == 2 then
      if VIPS[user.sName] then
         VIPS[user.sName]=nil
         vips=vips - 1
      end
   end
end

function OpDisconnected(user)
   if OPS[user.sName] then
      OPS[user.sName]=nil
      ops = ops -1
   end
end
plop

Thank U Plop, what i really want is to put that script into this one, to get these line

   user:SendData(Bot, "   ? Ops Online: "..OPS[user.sName]..".")

i tried to merge them, But is not working for me :( i allways get 1 Op and if there is no Ops the script get error syntax..



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..", Bem vindo ao -=[- "..frmHub:GetHubName().." -]=-")  
   
user:SendData(Bot"
	
? Seu endere?o IP: "
..user.sIP
   
user:SendData(Bot"
	
? Website: [URL]www.lusobrasil.tk[/URL]"

   
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"
	
? Digite: !ajuda no main chat."

   
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..", Bem vindo ao -=[- "..frmHub:GetHubName().." -]=-"
   
user:SendData(Bot"
	
? Seu endere?o IP: "
..user.sIP
   
user:SendData(Bot"
	
? Website: [URL]www.lusobrasil.tk[/URL]"

   
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"
	
? Digite: !ajuda e !ajuda.op no main chat."

   
user:SendData(Bot":p2p:-------------------------------------------------------------------------------------------------:p2p:"
end



 Sorry the english !! =\
 Ruuning Ptokax td4

plop

here you are.
Bot = "[operserv]" 
ops =0
vips = 0
VIPS = {}
OPS = {}

function NewUserConnected(user) 
   if user.iProfile == 2 then
      CountVips(user)
   end
   Message(user) 
end

function OpConnected(user) 
   CountOps(user)
   Message(user) 
end

function DataArrival(user,data) 
   if user.bOperator then
      CountOps(user)
   elseif user.iProfile == 2 then
      CountVips(user)
   end
end

function CountOps(user)
   if OPS[user.sName] == nil then
      OPS[user.sName]=1
      ops = ops + 1
   end
end

function CountVips(user)
   if VIPS[user.sName] == nil then
      VIPS[user.sName]=1
      vips=vips +1
   end
end

function UserDisconnected(user)
   if user.iProfile == 2 then
      if VIPS[user.sName] then
         VIPS[user.sName]=nil
         vips=vips - 1
      end
   end
end

function OpDisconnected(user)
   if OPS[user.sName] then
      OPS[user.sName]=nil
      ops = ops -1
   end
end

function Message(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..", Bem vindo ao -=[- "..frmHub:GetHubName().." -]=-") 
   user:SendData(Bot, "    ? Seu endere?o IP: "..user.sIP) 
   user:SendData(Bot, "    ? Website: [URL]www.lusobrasil.tk[/URL]") 
   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, "    ? There are "..ops.." Operators and "..vips.." VIPS online")
   user:SendData(Bot, "    ? Digite: !ajuda e !ajuda.op no main chat.") 
   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 <----<<

nEgativE

Thank U Plop .. working fine !! :)

xfiles

#5
Syntax error: bad argument #1 to `strfind' (string expected, got nil)
stack traceback:
1: function `strfind' [C]
2: function `Message' at line 59 [file `...25.dbg mit RoboCop v6.0d\scripts\OnJoinInfo.lua']
3: function `NewUserConnected' at line 12 [file `...25.dbg mit RoboCop v6.0d\scripts\OnJoinInfo.lua']




the fix bellow won?t show the syntaxerror above anymore.
thx to plop for the help. :)





Bot = "what-ever-you-want"

ops =0
vips = 0
VIPS = {}
OPS = {}

function NewUserConnected(user)
if user.iProfile == 2 then
CountVips(user)
end
Message(user)
end

function OpConnected(user)
CountOps(user)
Message(user)
end

function DataArrival(user,data)
if user.bOperator then
CountOps(user)
elseif user.iProfile == 2 then
CountVips(user)
end
end

function CountOps(user)
if OPS[user.sName] == nil then
OPS[user.sName]=1
ops = ops + 1
end
end

function CountVips(user)
if VIPS[user.sName] == nil then
VIPS[user.sName]=1
vips=vips + 1
end
end

function UserDisconnected(user)
if user.iProfile == 2 then
if VIPS[user.sName] then
VIPS[user.sName]=nil
vips=vips - 1
end
end
end

function OpDisconnected(user)
if OPS[user.sName] then
OPS[user.sName]=nil
ops = ops - 1
end
end

function Message(user)
   if strfind(user.sMyInfoString, "$MyINFO") then
      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, ":--------------------------------------------------------------------------------------------------------------------:")
      user:SendData(Bot, "         Hello, "..user.sName.."")
      user:SendData(Bot, "")
      user:SendData(Bot, "   ? Your IP            ==> "..user.sIP)
      user:SendData(Bot, "   ? Welcome to         ==> "..frmHub:GetHubName().."")
      user:SendData(Bot, "   ? Your Status in this Hub      ==> "..(GetProfileName(user.iProfile) or "Not registered"))
      user:SendData(Bot, "   ? You are sharing         ==> "..share.." GB")
      user:SendData(Bot, "   ? Actual Share in the Hub      ==> "..hubshare.." GB")
      user:SendData(Bot, "   ? Operators Online         ==> "..ops.."")
      user:SendData(Bot, "   ? VIPs Online         ==> "..vips.."")
      user:SendData(Bot, "   ? Total Users in the Hub      ==> "..frmHub:GetUsersCount().."")
      user:SendData(Bot, ":--------------------------------------------------------------------------------------------------------------------:")
   end
end

SMF spam blocked by CleanTalk