Advertisement
adrianoswatt

Reset_System - TalkActions

Nov 2nd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 KB | None | 0 0
  1. local cfg = {
  2.     storage = 12129, -- Storage que salva reset
  3.     kick_seconds = 3, -- Segundos antes de kickar o player
  4.     reset_effect = CONST_ME_SOUND_GREEN, -- Efeito ao Resetar
  5.     reset_multiply = 1000, -- Ex: Cada reset precisará de 1000 leveis a mais para o próximo
  6.     level_multiply = 4200, -- Exp para o Level 8 (Consulte na Tabela a Quantidade para Level Desejado)
  7.     }
  8.  
  9. function onSay(cid, words, param)
  10.     if not hasCondition(cid, CONDITION_INFIGHT) then
  11.         sto = getPlayerStorageValue(cid, cfg.storage)
  12.         if sto < 1 then
  13.             if getPlayerLevel(cid) >= cfg.reset_multiply then
  14.                 doPlayerResetBySwatt(cid)
  15.                 setPlayerStorageValue(cid, cfg.storage, 1)
  16.                 doPlayerSendTextMessage(cid, , "You have make your first reset succesfully, your character be kicked in "..cfg.kick_seconds.." seconds.")
  17.             else
  18.                 doPlayerSendCancel(cid, "You need level "..cfg.reset_multiply.." to do your first reset.")
  19.             end
  20.         else
  21.             if getPlayerLevel(cid) >= ((sto+1) * cfg.reset_multiply) then
  22.                 doPlayerResetBySwatt(cid)
  23.                 setPlayerStorageValue(cid, cfg.storage, sto+1)
  24.                 doPlayerSendTextMessage(cid, , "You have been reset for "..(sto+1).." succesfully, your character be kicked in "..cfg.kick_seconds.." seconds.")
  25.             else
  26.                 doPlayerSendCancel(cid, "You need level "..((sto+1) * cfg.reset_multiply).." to do your first reset.")
  27.             end
  28.         end
  29.     else
  30.         doPlayerSendCancel(cid, "You can't stay infight to execute this command.")
  31.     end
  32. return true
  33. end
  34.  
  35. function doPlayerResetBySwatt(cid)
  36.     getHealth, getMana = getCreatureMaxHealth(cid), getCreatureMaxMana(cid)
  37.     remove_exp = getPlayerExperience(cid)
  38.     doPlayerAddExp(cid, -remove_exp)
  39.     doPlayerAddExp(cid, cfg.level_multiply)
  40.     setCreatureMaxHealth(cid, getHealth)
  41.     setCreatureMaxMana(cid, getMana)
  42.     doSendMagicEffect(getThingPos(cid), cfg.reset_effect)
  43.     addEvent(doRemoveCreature, cfg.kick_seconds * 1000, cid)
  44. return true
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement