Postado Setembro 19, 2017 7 anos Autor @KotZletY Desculpa reviver o tópico, mas o player volta para o level 8, mas com a vida e mana de level 200.... teria como por pra eles voltarem com 185 de vida e 35 de mana? @Dwarfer
Postado Setembro 19, 2017 7 anos @Yamborghini Spoiler 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 local c = { price = 50000, vocations = {5,6,7,8}, newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido. pos = {x=723, y=599, z=7}, -- Pos do templo tmp = 3 -- apos esses segundos ele desloga automaticamente. } local hp = 185 local mp = 35 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local playerid = getPlayerGUID(cid) local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local xp = getExperienceForLevel(c.newlevel) if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..c.price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(c.vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,c.price) == TRUE then setCreatureMaxHealth(cid, hp) setCreatureMaxMana(cid, mp) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") doPlayerSetPromotionLevel(cid, 2) doTeleportThing(cid, c.pos) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") talkState[talkUser] = 0 else selfSay('Você não tem ' .. c.price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 19, 2017 7 anos Autor Em 19/09/2017 em 18:03, Dwarfer disse: @Yamborghini Mostrar conteúdo oculto 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 local c = { price = 50000, vocations = {5,6,7,8}, newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido. pos = {x=723, y=599, z=7}, -- Pos do templo tmp = 3 -- apos esses segundos ele desloga automaticamente. } local hp = 185 local mp = 35 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local playerid = getPlayerGUID(cid) local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local xp = getExperienceForLevel(c.newlevel) if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..c.price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(c.vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,c.price) == TRUE then setCreatureMaxHealth(cid, hp) setCreatureMaxMana(cid, mp) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") doPlayerSetPromotionLevel(cid, 2) doTeleportThing(cid, c.pos) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") talkState[talkUser] = 0 else selfSay('Você não tem ' .. c.price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 10, 2018 7 anos por Yamborghini (veja o histórico de edições)
Postado Fevereiro 10, 2018 7 anos Autor Em 19/09/2017 em 18:03, Dwarfer disse: @Yamborghini Ocultar conteúdo 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 local c = { price = 50000, vocations = {5,6,7,8}, newlevel = 8, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido. pos = {x=723, y=599, z=7}, -- Pos do templo tmp = 3 -- apos esses segundos ele desloga automaticamente. } local hp = 185 local mp = 35 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local playerid = getPlayerGUID(cid) local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local xp = getExperienceForLevel(c.newlevel) if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..c.price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(c.vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,c.price) == TRUE then setCreatureMaxHealth(cid, hp) setCreatureMaxMana(cid, mp) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") doPlayerSetPromotionLevel(cid, 2) doTeleportThing(cid, c.pos) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") talkState[talkUser] = 0 else selfSay('Você não tem ' .. c.price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) O player não está voltando com 185 de Hp e 35 de mana!
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.