PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: HillyBilly on 10 August, 2005, 20:07:29

Title: syntax error in script: Rev Blocker by jiten
Post by: HillyBilly on 10 August, 2005, 20:07:29
I get the next error, need some help

Syntax ...HUB\~    ~Ptokax HUB draait\scripts\NoShare.lua5.lua:75: attempt to perform arithmetic on field `iNormalHubs' (a nil value)

Its this line:          elseif (curUser.iNormalHubs + curUser.iRegHubs) > MaxHubs then

This is the script:
--$Rev Blocker by jiten

-- restriction for MinSlots, MinShare and MaxHubs
-- Blok users from download when not met mishare etc.
-- Added: Immune Table for Non-Operators

-- Changed: Normal and Reg Hub Check

-- some ideas taken from leech bot and ShaveShare v4.8 by Herodes





kb = 1024

mb = 1024 ^ 2

gb = 1024 ^ 3



MinShare = 500*mb -- in MBs

MinSlots = 1

MaxHubs = 200

tImmune = { ["[HB]HillyBilly"] = 1, ["nick2"] = 1, } -- Non-Operators Immune List (["nick"] = 1)



DoShareUnits = function(intSize) --- Thanks to kepp and NotRambitWombat

if intSize ~= 0 then

local tUnits = { "Bytes", "KB", "MB", "GB", "TB" }

intSize = tonumber(intSize);

local sUnits;

for index = 1, table.getn(tUnits) do

if(intSize < 1024) then sUnits = tUnits[index]; break; else intSize = intSize / 1024; end

end

return string.format("%0.1f %s",intSize, sUnits);

else

return "nothing"

end

end



ConnectToMeArrival = function(curUser,data)

if not curUser.bOperator then

if not tImmune[curUser.sName] then

if curUser.iShareSize < MinShare then

return curUser:SendData("*** You have to share at least "..DoShareUnits(MinShare).." to be able to download.\r\n\                      How To: Type in mainchat       =======>     +share      <======     don't forget the   +   symbol"),1

elseif curUser.iSlots < MinSlots then

return curUser:SendData("*** You must have "..MinSlots.." open slots to be able to download."),1

elseif (curUser.iNormalHubs + curUser.iRegHubs) > MaxHubs then

return curUser:SendData("*** You can't be in more than "..MaxHubs.." hubs to be able to download."),1

end

end

end

end



RevConnectToMeArrival = ConnectToMeArrival
Title:
Post by: HillyBilly on 11 August, 2005, 20:32:23
Thnxs Mutor works fine now and for the explanation

Cheers HB
Title:
Post by: chettedeboeuf on 12 September, 2005, 19:54:11
Thank you Mutor