daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest May 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local config = {
  2.  
  3.     stamina = 1,        -- Quantos minutos da Stamina aumentará
  4.     time = 3,        -- Intervalo(em minutos) para subir a stamina
  5.  
  6. }
  7.  
  8.  
  9. local function getStaminaTime(m)
  10.     local hours = math.floor(m / 60)
  11.     local minutes = m - hours * 60
  12.     return hours, minutes
  13. end
  14.  
  15. local function startAddingStamina(cid)
  16.     if not isPlayer(cid) or getCreatureStorage(cid, 432721) == EMPTY_STORAGE then
  17.         return
  18.     end
  19.     local stamina = getPlayerStamina(cid)
  20.     if stamina >= 2520 then
  21.         return
  22.     end
  23.     doPlayerAddStamina(cid, config.stamina)
  24.     local h, m = getStaminaTime(stamina)
  25.     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Stamina Trainer] Você está em na área de treiner, sua Stamina aumentará a cada 3 minutos. Você agora tem ".. h ..":".. m .." de stamina.")
  26.     addEvent(startAddingStamina, config.time * 60000, cid)
  27. end
  28.  
  29. function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
  30.     if getCreatureStorage(cid, 432722) < os.time() then
  31.         doCreatureSetStorage(cid, 432721, 1)
  32.         doCreatureSetStorage(cid, 432722, os.time() + (config.time * 60))
  33.         startAddingStamina(cid)
  34.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Stamina Trainer] Você começou a treinar, sua stamina sobe 1 minuto a cada 3 minutos de treino.")
  35.     end
  36.     return true
  37. end
  38.  
  39. function onStepOut(cid)
  40.     doCreatureSetStorage(cid, 432721, EMPTY_STORAGE)
  41.     return true
  42. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top