Ir para conteúdo
  • Cadastre-se

(Resolvido)Comprar promotion talkaction !buypromotion ?


Ir para solução Resolvido por Wakon,

Posts Recomendados

function onSay(cid, words, param) 

local newvoc = getPromotedVocation(getPlayerVocation(cid))  
local price = 20000
             
    if getPlayerPremiumDays(cid) > 0 then
        if getPlayerMoney(cid) >= price then
            doPlayerSetVocation(cid,newvoc)
            doPlayerRemoveMoney(cid, price)
            doPlayerSendCancel(cid, "Parabens voce foi promovido.")
        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

           
<talkaction words="!buypromotion" event="script" value="seuarquivo.lua"/>


Tenta isso.
 

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites
function onSay(cid, words, param) 

local newvoc = getPromotedVocation(getPlayerVocation(cid))  
local price = 20000
             
    if getPlayerPremiumDays(cid) > 0 then
        if getPlayerMoney(cid) >= price then
            doPlayerSetVocation(cid,newvoc)
            doPlayerRemoveMoney(cid, price)
            doPlayerSendCancel(cid, "Parabens voce foi promovido.")
        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

           
<talkaction words="!buypromotion" event="script" value="seuarquivo.lua"/>


Tenta isso.


 

deu esse erro:

[17/10/2015  00:17:47] Lua Script Error: [TalkAction Interface] 
[17/10/2015  00:17:47] data/talkactions/scripts/promotion.lua:onSay

[17/10/2015  00:17:47] data/talkactions/scripts/promotion.lua:14: attempt to call global 'getPlayerPromotionLevel' (a nil value)
[17/10/2015  00:17:47] stack traceback:
[17/10/2015  00:17:47]     data/talkactions/scripts/promotion.lua:14: in function <data/talkactions/scripts/promotion.lua:8>

Link para o post
Compartilhar em outros sites

deu esse erro:

[17/10/2015  00:17:47] Lua Script Error: [TalkAction Interface] 
[17/10/2015  00:17:47] data/talkactions/scripts/promotion.lua:onSay

[17/10/2015  00:17:47] data/talkactions/scripts/promotion.lua:14: attempt to call global 'getPlayerPromotionLevel' (a nil value)
[17/10/2015  00:17:47] stack traceback:
[17/10/2015  00:17:47]     data/talkactions/scripts/promotion.lua:14: in function <data/talkactions/scripts/promotion.lua:8>


Humm, você não tem essa função, "vou arrumei".

 

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

 



 

Editado por Caronte
I'm sexy and i know it. (veja o histórico de edições)

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites

Humm, você não tem essa função, "vou arrumei".

 

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

 



 

obrigado por arrumar, "funcionou" mas Não "funcionou"
porque até freeaccounts estão conseguindo se promover.

Link para o post
Compartilhar em outros sites

Aaa esqueci, fiz um negócio pra testar e esqueci de tirar.

Mude isso:

if getPlayerPremiumDays(cid) >= 0 then
Para isso:
if getPlayerPremiumDays(cid) > 0 then


Irá funcionar do jeito que você quer... Editado por Caronte (veja o histórico de edições)

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

Link para o post
Compartilhar em outros sites

Aaa esqueci, fiz um negócio pra testar e esqueci de tirar.

Mude isso:

if getPlayerPremiumDays(cid) >= 0 then

Para isso:

if getPlayerPremiumDays(cid) > 0 then

 

Irá funcinar do jeito que você quer...

cara vc é fera, de todos os forums vc foi o unico que conseguiu, funcionou
a unica coisa é que até lvl 8 está podendo comprar, em vez  de lvl 20+ mas creio que não tem como arrumar isso ou tem?

Editado por telefonesemfio (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução
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 level = 20
             		 
	if getPlayerLevel(cid) < level then
        return doPlayerSendCancel(cid, 'Voce precisa ser level '.. level ..' comprar promotion'.) and true
	end
	
    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
Link para o post
Compartilhar em outros sites
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 level = 20
             		 
	if getPlayerLevel(cid) < level then
        return doPlayerSendCancel(cid, 'Voce precisa ser level '.. level ..' comprar promotion'.) and true
	end
	
    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

vlw =)

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo