Postado Fevereiro 13, 2018 7 anos Autor 2 horas atrás, SoulSarti disse: voce pode fazer dessa forma: 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 local x = {1,2} -- Ids das vocaçoes necessarias pra promote. para adicionar mais, basta por uma virgula dps do ultimo numero e adicionar a id da voc local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar local v = getVocationInfo(getPlayerVocation(cid)) if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 then if isInArray(x, getPlayerVocation(cid)) then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setPlayerPromotionLevel(cid, v.id + 4) -- aqui o sistema pega a vocação atual e adicona a proxima (v.id + 4). assim, basta adicionar a voc base na variavel x. setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 4200 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the required vocation', cid) end else selfSay('You have already been promoted', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) no outro codigo, nao havia a função para promover o jogador e seriam necessarios npcs diferentes pra cada voc. com esse, um unico npc pode promover qlqr personagem desde que a vocação dele seja guardada na variavel x. Muito obrigado! Mas esqueci de fazer um pedido, acho que simples... Um level mínimo para a promote, no caso lvl 500
Postado Fevereiro 13, 2018 7 anos 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 local x = {1,2} -- Ids das vocaçoes necessarias pra promote. para adicionar mais, basta por uma virgula dps do ultimo numero e adicionar a id da voc local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local lvlmin = 500 --lvl para resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar local v = getVocationInfo(getPlayerVocation(cid)) if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 and getPlayerLevel(cid) >= lvlmin then if isInArray(x, getPlayerVocation(cid)) then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setPlayerPromotionLevel(cid, v.id + 4) -- aqui o sistema pega a vocação atual e adicona a proxima (v.id + 4). assim, basta adicionar a voc base na variavel x. setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 4200 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the required vocation', cid) end else selfSay('You have already been promoted or doesnt have the necessary experience', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) pronto só dar aquele rep, se possivel, pra mim e pro sttorm, por ter criado a base do script hahaha
Postado Fevereiro 13, 2018 7 anos Autor 2 minutos atrás, SoulSarti disse: 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 local x = {1,2} -- Ids das vocaçoes necessarias pra promote. para adicionar mais, basta por uma virgula dps do ultimo numero e adicionar a id da voc local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local lvlmin = 500 --lvl para resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar local v = getVocationInfo(getPlayerVocation(cid)) if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 and getPlayerLevel(cid) >= lvlmin then if isInArray(x, getPlayerVocation(cid)) then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setPlayerPromotionLevel(cid, v.id + 4) -- aqui o sistema pega a vocação atual e adicona a proxima (v.id + 4). assim, basta adicionar a voc base na variavel x. setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 4200 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the required vocation', cid) end else selfSay('You have already been promoted or doesnt have the necessary experience', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) pronto só dar aquele rep, se possivel, pra mim e pro sttorm, por ter criado a base do script hahaha Dei 2 reps! irei testar e falo com voces! 22 minutos atrás, SoulSarti disse: 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 local x = {1,2} -- Ids das vocaçoes necessarias pra promote. para adicionar mais, basta por uma virgula dps do ultimo numero e adicionar a id da voc local sto = 4642 -- storage praq ele n faça a promotion novamente local lvl = 8 -- lvl ao resetar local lvlmin = 500 --lvl para resetar local health = 185 -- hp ao resetar local mana = 35 -- mana ao resetar local v = getVocationInfo(getPlayerVocation(cid)) if (msgcontains(msg, 'promotion')) then if getPlayerStorageValue(cid, sto) == -1 and getPlayerLevel(cid) >= lvlmin then if isInArray(x, getPlayerVocation(cid)) then local playerid = getPlayerGUID(cid) selfSay('Congratulations! You were promoted', cid) setPlayerStorageValue(cid, sto, 1) setPlayerPromotionLevel(cid, v.id + 4) -- aqui o sistema pega a vocação atual e adicona a proxima (v.id + 4). assim, basta adicionar a voc base na variavel x. setCreatureMaxHealth(cid, health) setCreatureMaxMana(cid, mana) db.executeQuery("UPDATE `players` SET `level`="..lvl..",`experience`= 4200 WHERE `players`.`id`= ".. playerid .."") else selfSay('You do not have the required vocation', cid) end else selfSay('You have already been promoted or doesnt have the necessary experience', cid) end return true end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) pronto só dar aquele rep, se possivel, pra mim e pro sttorm, por ter criado a base do script hahaha Amigo, deu erro! o personagem não mudoo de voc, ficou assim: 16:51 Your last visit was on Tue Feb 13 16:49:53 2018. 16:51 You see yourself. You are . You Has Killed: [0] Players. You Has Died: [2] Times. Frags: [0]. e não mudou a vida tb
Postado Fevereiro 13, 2018 7 anos 3 horas atrás, Yamborghini disse: Dei 2 reps! irei testar e falo com voces! Amigo, deu erro! o personagem não mudoo de voc, ficou assim: 16:51 Your last visit was on Tue Feb 13 16:49:53 2018. 16:51 You see yourself. You are . You Has Killed: [0] Players. You Has Died: [2] Times. Frags: [0]. e não mudou a vida tb tem como mostrar o erro na distro?
Postado Fevereiro 14, 2018 7 anos Autor 2 horas atrás, SoulSarti disse: tem como mostrar o erro na distro? eu consegui fazer esse funcionar, porém, a vida e a mana não voltam e da alguns erros no console.... se você puder testar , estou no Celular https://mega.nz/#!BkZ12CZa!PoW5-Vy0k-MiVs9CHX5o7j_Zo6VoAVdPjwIfMwNwiAE OBS: 8.6 TFS0.4 Editado Fevereiro 14, 2018 7 anos por Yamborghini (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.