Ir para conteúdo

Featured Replies

Postado

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

Resolvido por Sekk

Ir para solução
  • Respostas 9
  • Visualizações 852
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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] =

  • function onSay(cid, words, param)  local vocs = { [1] = 5, -- master sorcerer                [2] = 6, -- elder druid                [3] = 7, -- royal paladin                [4] = 8

Postado

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

 

Postado

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 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
  • 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

 

Postado

@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.

Visitante
Responder

Quem Está Navegando 0

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

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo