Ir para conteúdo

Featured Replies

Postado

Alguem ajuda a coloca pra cada 5 resets o player ganhar 3 items (modificado)

EX: ele deu o QUINTO reset, ai vai ganhar...ai no DECIMO RESET....

item: 2160, 50

item: 9971, 5

item: 10558, 25

local config = {

minlevel = 4000, --- initial level to reset

price = 1000000, ---initial price to reset

newlevel = 150, --- level after reset

priceByReset = 2000000, --- price added per reset

percent = 10, ---- percentage of health/mana you will have upon reset (relative to your old total health)

maxresets = 100,

levelbyreset = 0 --- how much more level will you need in the next reset

}

function getResets(uid)

resets = getPlayerStorageValue(uid, 14335)

if resets < 0 then

resets = 0

end

return resets

end

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end

function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end

function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end

function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)

if not npcHandler:isFocused(cid) then

return false

end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

function addReset(cid)

if(npcHandler:isFocused(cid)) then

npcHandler:releaseFocus(cid)

end

talkState[talkUser] = 0

resets = getResets(cid)

setPlayerStorageValue(cid, 14335, resets+1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

local hp = getCreatureMaxHealth(cid)

local resethp = hp*(config.percent/100)

setCreatureMaxHealth(cid, resethp)

local differencehp = (hp - resethp)

doCreatureAddHealth(cid, -differencehp)

local mana = getCreatureMaxMana(cid)

local resetmana = mana*(config.percent/100)

setCreatureMaxMana(cid, resetmana)

local differencemana = (mana - resetmana)

doCreatureAddMana(cid, -differencemana)

doRemoveCreature(cid)

local description = resets+1

local description = resets+1

db.query("UPDATE players SET level="..config.newlevel.."experience= 0 WHERE playersid= ".. playerid .."")

return true

end

local newPrice = config.price + (getResets(cid) * config.priceByReset)

local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

if msgcontains(msg, 'reset') then

if getResets(cid) < config.maxresets then

selfSay('[RESET] Voce quer resetar seu personagem? custa '..newPrice..' gp\'s!', cid)

talkState[talkUser] = 1

else

selfSay('[RESET] Voce ja atingiu o maximo de resetes!', cid)

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerMoney(cid) < newPrice then

selfSay('[RESET] E necessario ter '..newPrice..' gp\'s para resetar!', cid)

elseif getPlayerLevel(cid) < newminlevel then

selfSay('[RESET] O minimo para resetar e level '..newminlevel..'!', cid)

else

doPlayerRemoveMoney(cid,newPrice)

playerid = getPlayerGUID(cid)

addEvent(function()

if isPlayer(cid) then

addReset(cid)

end

end, 5000)

local number = getResets(cid)+1

local msg ="* Voce resetou!\n\n* [Reset(s): "..number.."]\n\n* Voce sera desconectado em 5 segundos para concluir o resete.\n\n* [Bonificacao]: 1 Baiak Token, 10% do Hp/Mp."

doPlayerPopupFYI(cid, msg)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

doBroadcastMessage("[RESET] ["..getPlayerName(cid).."] Acabou de Resetar ["..number.."] Reset(s).", MESSAGE_STATUS_CONSOLE_ORANGE)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

selfSay('Ok.', cid)

elseif msgcontains(msg, 'quantity') then

selfSay('[RESET] Voce tem no total de '..getResets(cid)..' reset(s).', cid)

talkState[talkUser] = 0

end

return true

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado por Tokias (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo