Guest User

exhaustion function

a guest
Mar 8th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. exhaustion =
  2. {
  3.     check = function (cid, storage)
  4.         return getPlayerStorageValue(cid, storage) >= os.time(t)
  5.     end,
  6.  
  7.     get = function (cid, storage)
  8.         local exhaust = getPlayerStorageValue(cid, storage)
  9.         if(exhaust > 0) then
  10.             local left = exhaust - os.time(t)
  11.             if(left >= 0) then
  12.                 return left
  13.             end
  14.         end
  15.  
  16.         return false
  17.     end,
  18.  
  19.     set = function (cid, storage, time)
  20.         setPlayerStorageValue(cid, storage, os.time(t) + time)
  21.     end,
  22.  
  23.     make = function (cid, storage, time)
  24.         local exhaust = exhaustion.get(cid, storage)
  25.         if(not exhaust) then
  26.             exhaustion.set(cid, storage, time)
  27.             return true
  28.         end
  29.  
  30.         return false
  31.     end
  32. }
Add Comment
Please, Sign In to add comment