Share Growth Checker Mod Please !
 

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

Share Growth Checker Mod Please !

Started by Mikey, 15 March, 2005, 05:54:00

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mikey

Hello. I have tried to modify this script so I can set it up to add certain names I want this to pm to...Not seeming to have to much luck with it...Could someone do it for me please.  Thanks, Mikey

P.S. I would also like the script to have a on/off feature to where that op can turn the message on and off if they don't want to see it. Example !share on/off


Bot = "?ShareCheck?"

sharertxt = "shares.txt" --Will be created in the script folder
sh = {}

function Main()
   frmHub:RegBot(Bot)
end

function NewUserConnected(user, data)
   local s,e,share = strfind(user.sMyInfoString, "%$%s*(%d+)%$")
   share = format("%0.2f", tonumber(share)/(1024*1024*1024))
   CheckShare(user, share)
end

OpConnected = NewUserConnected

function DataArrival(user, data)
   if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then
   data=strsub(data,1,strlen(data)-1)
   s,e,cmd = strfind(data,"%b<>%s+(%S+)")
      if (cmd=="!sgrw") then
         if (user.bOperator) then
            local s,e,who = strfind(data,"%b<>%s+%S+%s+(%S+)")
            if (who == nil or who == "") then
               user:SendPM(Bot, "Syntax Error, !sgrw , you must write a name.")
            else
               user:SendPM(Bot, CheckUser(who))
            end
         else
            user:SendPM(Bot, "You don?t have permission to use this command.")
         end
         return 1
      end
   end
end

function CheckUser(user)
local tmp = ""
   if (readfrom(sharertxt) == nil) then
      tmp = tmp.."the file hasn't been created yet."
   else
      readfrom(sharertxt)
      while 1 do
      local line = read()
         if (line == nil) then
            tmp = tmp.."The user "..user.." wasn't found in the list, have you write the right name ?"
            break
         else
            local s,e,who,lshare, fshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+(%S+)")
            if (who ~= nil and strlower(who) == strlower(user) ) then
               if (GetItemByName(user) ~= nil) then
                  tmp = tmp.."The user "..user.." is sharing "..lshare.." GB there last share was "..fshare.." GB."
               else
                  tmp = tmp.."The user "..user.." has shared "..lshare.." GB."
               end
               break
            end
         end
      end
      readfrom()
   end
return tmp
end
      

function CheckShare(user, share)
local tmp = ""
local time = 0
   if (readfrom(sharertxt) == nil) then
      writeto(sharertxt)
      write(user.sName.." & "..share.." & 0\r\n")
      writeto()
   else
      readfrom(sharertxt)
      while 1 do
      local line = read()
         if (line == nil) then
            if (time == 0) then
               tmp = tmp..user.sName.." & "..share.." & 0\r\n"
            end
            break
         else
            local s,e,who,nshare = strfind(line, "(%S+)%s+%&%s+(%S+)%s+&%s+%S+")
            if (who ~= nil and strlower(who) == strlower(user.sName)) then
               if (tonumber(nshare) > tonumber(share)) then
                  SendPmToOps(Bot, "The user "..user.sName.." has a smaller share then there last loggin.")
                  SendPmToOps(Bot, "They had "..nshare.." GB and now they have "..share.." GB.")
                  tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
                  sh[user.sName] = share
                  time = 1
               elseif (tonumber(nshare) < tonumber(share)) then
                  SendPmToOps(Bot, "The user "..user.sName.." has more shared then there last loggin.")
                  SendPmToOps(Bot, "They had "..nshare.." GB and now they have "..share.." GB.")
                  tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
                  sh[user.sName] = share
                  time = 1
               elseif (tonumber(nshare) == tonumber(share)) then
                  tmp = tmp..user.sName.." & "..share.." & "..nshare.."\r\n"
                  sh[user.sName] = share
                  time = 1
               end
            else
               tmp = tmp..line.."\r\n"
            end
         end
      end
      readfrom()
      writeto(sharertxt)
      write(tmp)
      writeto()
   end
end
Mikey

**Friends Unlimited Network**
    Network Founder

Mikey

Could someone please give me a hand and make the mod for this script. I really need it. Thanks !
Mikey

**Friends Unlimited Network**
    Network Founder

SMF spam blocked by CleanTalk