Ir para conteúdo
  • Cadastre-se

(Resolvido)Comando ganhar outfit !


Ir para solução Resolvido por gabrielzika,

Posts Recomendados

@leozincorsair acho que já sei, testa ai...

local vocs = {
[1] = {outfit = 400, effect = 35, cd = 1, vname = "Sakura", id = 1},
[2] = {outfit = 93, effect = 14, cd = 1, vname = "Sasuke Akatsuki", id = 502},
[3] = {outfit = 402, effect = 35, cd = 1, vname = "Naruto", id = 3},
}

local storage = 4444 -- storage para nao poder ficar usando toda hora..

function onSay(cid, words, param)

if (param == '') then
        local str = ""
        str = str .. "Vocations:\n\n"
            for a = 1, #vocs do
                str = str..""..vocs[a].vname.."\n"
            end
        doShowTextDialog(cid, 7416, str)
    return true
    end
    
if getPlayerStorageValue(cid, storage) >= 1 then
doPlayerSendTextMessage(cid,25,"Você já está usando uma outfit.")
return true
end     
    
for x = 1, #vocs do
            if string.find(string.lower(vocs[x].vname), string.lower(param)) and getPlayerVocation(cid) ~= vocs[x].id then
                doPlayerSendTextMessage(cid,25,"Sua vocação é " .. getPlayerVocationName(cid) ..".")  -- quando alguem tenta usar outfit q n é da sua vocação
            end    
        end        
    
for x = 1, #vocs do
            if string.find(string.lower(vocs[x].vname), string.lower(param)) and getPlayerVocation(cid) == vocs[x].id then
                addEvent(
                function()
                doRemoveCondition(cid, CONDITION_OUTFIT)
                setPlayerStorageValue(cid, storage, -1)
                end,
                vocs[x].cd * 60 * 1000) -- tempo em minutos para a outfit sair
                doSendMagicEffect(getThingPos(cid), vocs[x].effect) -- efeito que sai quando usa o comando
                doSetCreatureOutfit(cid, {lookType = vocs[x].outfit, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
                setPlayerStorageValue(cid, storage, 1)
                doPlayerSendTextMessage(cid,25,"Você ganhou temporariamente um outfit de ".. vocs[x].vname .."!")
            end    
        end            
return true
end

 

Link para o post
Compartilhar em outros sites
  • Solução

@leozincorsair em vname = "Sasuke Akatsuki" você tem que colocar o nome certinho da vocação, caso contrário não vai ir.... aqui de todas a maneiras q mandei até agora, funcinou 100%

 

Tenta assim:

 

local vocs = {
[1] = {outfit = 400, effect = 35, cd = 1, vname = "Sakura"},
[2] = {outfit = 93, effect = 14, cd = 1, vname = "Sasuke Akatsuki"},
[3] = {outfit = 402, effect = 35, cd = 1, vname = "Naruto"},
}

local storage = 4444 -- storage para nao poder ficar usando toda hora..

function onSay(cid, words, param)

if (param == '') then
        local str = ""
        str = str .. "Vocations:\n\n"
            for a = 1, #vocs do
                str = str..""..vocs[a].vname.."\n"
            end
        doShowTextDialog(cid, 7416, str)
    return true
    end
    
if getPlayerStorageValue(cid, storage) >= 1 then
doPlayerSendTextMessage(cid,25,"Você já está usando uma outfit.")
return true
end     
    
for x = 1, #vocs do
            if string.find(string.lower(vocs[x].vname), string.lower(param)) and getPlayerVocationName(cid) ~= vocs[x].vname then
                doPlayerSendTextMessage(cid,25,"Sua vocação é " .. getPlayerVocationName(cid) ..".")  -- quando alguem tenta usar outfit q n é da sua vocação
            end    
        end        
    
for x = 1, #vocs do
            if string.find(string.lower(vocs[x].vname), string.lower(param)) and getPlayerVocationName(cid) == vocs[x].vname then
                addEvent(
                function()
                doRemoveCondition(cid, CONDITION_OUTFIT)
                setPlayerStorageValue(cid, storage, -1)
                end,
                vocs[x].cd * 60 * 1000) -- tempo em minutos para a outfit sair
                doSendMagicEffect(getThingPos(cid), vocs[x].effect) -- efeito que sai quando usa o comando
                doSetCreatureOutfit(cid, {lookType = vocs[x].outfit, lookHead = getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet}, -1)
                setPlayerStorageValue(cid, storage, 1)
                doPlayerSendTextMessage(cid,25,"Você ganhou temporariamente um outfit de ".. vocs[x].vname .."!")
            end    
        end            
return true
end

 

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.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo