Postado Dezembro 12, 2015 9 anos Bom galera, no meu server, tem a talkaction !promotion, que ao usar, o player é promovido, como exemplo: o paladin usa o comando, ai ele vira royal paladin entendeu? Então, eu testei vários scripts de promotion, mas nenhum funciona devidamente no server, ele chegam a promover o player, mas se o mesmo deslogar ou ser morto, ele perde o promotion... Ja teste vários scripts, e o meu atural script é: Spoiler function onSay(cid, words, param) local vocs = { [1] = 5, -- master sorcerer [2] = 6, -- elder druid [3] = 7, -- royal paladin [4] = 8, -- elite knight } local newvoc = vocs[getPlayerVocation(cid)] local price = 20000 if getPlayerPremiumDays(cid) > 0 then if getPlayerMoney(cid) >= price then if vocs[getPlayerVocation(cid)] then doPlayerSetVocation(cid,newvoc) doPlayerRemoveMoney(cid, price) doPlayerSendCancel(cid, "Parabens voce foi promovido.") else doPlayerSendCancel(cid, "Voce nao pode ser promovido.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce nao tem dinheiro suficiente.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce precisa ser premium para usar esse comando.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return true end O que pode ocasionar o problema? Ele simplesmente não salva a vocation nova do player.. ME AJUDEM POR FAVOR!! USO TFS 0.4 GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Dezembro 13, 2015 9 anos Tente o seguinte, altere o script da talkaction para esse: function onSay(cid, words, param) local vocs = { [1] = 5, -- master sorcerer [2] = 6, -- elder druid [3] = 7, -- royal paladin [4] = 8, -- elite knight } local newvoc = vocs[getPlayerVocation(cid)] local price = 20000 if getPlayerPremiumDays(cid) > 0 then if getPlayerMoney(cid) >= price then if vocs[getPlayerVocation(cid)] then doPlayerSetVocation(cid,newvoc) doPlayerRemoveMoney(cid, price) setPlayerStorageValue(cid, 49994, newvoc) doPlayerSendCancel(cid, "Parabens voce foi promovido.") else doPlayerSendCancel(cid, "Voce nao pode ser promovido.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce nao tem dinheiro suficiente.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce precisa ser premium para usar esse comando.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return true end Depois, vá em "Data/creaturescripts/scripts", abra o arquivo login.lua e adicione: if getPlayerStorageValue(cid, 49994) > 0 and isPremium(cid) then doPlayerSetVocation(cid, getPlayerStorageValue(cid, 49994)) end ➥ Regras | Seções OTServ | Seções BOT
Postado Dezembro 13, 2015 9 anos function onSay(cid, words, param) local vocs = { [1] = 5, -- master sorcerer [2] = 6, -- elder druid [3] = 7, -- royal paladin [4] = 8, -- elite knight } local newvoc = vocs[getPlayerVocation(cid)] local price = 20000 local guid = getPlayerGUID(cid) if getPlayerPremiumDays(cid) > 0 then if getPlayerMoney(cid) >= price then if vocs[getPlayerVocation(cid)] then doPlayerRemoveMoney(cid, price) doRemoveCreature(cid) db.executeQuery('UPDATE `players` SET `vocation` = "' ..newvoc.. '" WHERE `id` = "' ..guid.. '";') else doPlayerSendCancel(cid, "Voce nao pode ser promovido.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce nao tem dinheiro suficiente.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end else doPlayerSendCancel(cid, "Voce precisa ser premium para usar esse comando.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) end return true end Editado Dezembro 13, 2015 9 anos por mateusak (veja o histórico de edições) Não se esqueça de dar REP+ para quem te ajudou e caso seja a solução marcar como melhor resposta! NÃO CLIQUE AQUI! NEM AQUI! ________________________________________________________________________________________________________________________________________________________________________________________________________________________ “A imaginação é mais importante que o conhecimento.” Albert Einstein
Postado Dezembro 13, 2015 9 anos Autor @mateusak Spoiler [21:0:50.132] [Error - TalkAction Interface] [21:0:50.132] data/talkactions/scripts/promotion.lua:onSay [21:0:50.132] Description: [21:0:50.133] data/talkactions/scripts/promotion.lua:16: attempt to call field 'Query' (a nil value) [21:0:50.133] stack traceback: [21:0:50.135] data/talkactions/scripts/promotion.lua:16: in function <data/talkactions/scripts/promotion.lua:1> [21:0:50.137] [Error - NpcScript Interface] [21:0:50.137] data/npc/scripts/default.lua:onCreatureSay [21:0:50.138] Description: [21:0:50.139] (luaGetNpcDistanceTo) Thing not found GitHub: https://github.com/s3kk Conteúdo: [SERVER] Heromassa[GESIOR] Gesior 2012 modificado por Sekk[GESIOR] Shop Addons & Mounts - TFS 1.x[GESIOR] Outfitter para Characters e Rank[SISTEMA] Castle 24h[TALKACTION] Multi Element Wand[ACTION] Multi Elemental Arrow & Shield[PROGRAMAÇÃO] Compilar TFS 0.4 no Linux[PROGRAMAÇÃO] Compilando TFS 0.4 no MSVC(x64 e x32) [INFRAESTRUTURA] Configuração COMPLETA Google VM + Tibia 11.x
Postado Dezembro 14, 2015 9 anos @Sekk Tenta trocar de 'db.executeQuery' para 'db.query'. Não se esqueça de dar REP+ para quem te ajudou e caso seja a solução marcar como melhor resposta! NÃO CLIQUE AQUI! NEM AQUI! ________________________________________________________________________________________________________________________________________________________________________________________________________________________ “A imaginação é mais importante que o conhecimento.” Albert Einstein
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.