#if statement doing the opposite thing.

1 messages · Page 1 of 1 (latest)

vast silo
#
        if HasItem then
            if  0 < (os.time() - RentTable[2]) then
                GiveItem()
            elseif 0 > (os.time() - RentTable[2]) then
                print(os.time() - RentTable[2])
                print("Removing")
                table.remove(PlayerDataStore.Value["InRent"], table.find(PlayerDataStore.Value["InRent"], RentTable))
            else
                print("Lua is stupid")
            end
        end
#

Output:

#
14:18:06.105  Renting Item in Progress  -  Server - LockerSystem:100
  14:18:06.107  Found Item  -  Server - LockerSystem:103
  14:18:06.107   ▶ {...}  -  Server - LockerSystem:109
  14:18:07.972   ▶ {...}  -  Server - LockerSystem:160
  14:18:07.973  -119  -  Server - LockerSystem:166
  14:18:07.973  Removing  -  Server - LockerSystem:167
honest hare
#

I think the statement should look like this

if (os.time() - RentTable[2]) > 0 then
something 
end 
#

Otherwise it will substrace zero, returning a negative number

vast silo
#

oh wait

#
        if HasItem then
            if  0 < (RentTable[2] - os.time()) then
                GiveItem()
            else
                print(os.time() - RentTable[2])
                table.remove(PlayerDataStore.Value["InRent"], table.find(PlayerDataStore.Value["InRent"], RentTable))
            end
        end

solution

honest hare
#

Well that's either way