Ir para conteúdo
  • Cadastre-se

(Resolvido)Urgente, bug no script !comprar


Ir para solução Resolvido por Vodkart,

Posts Recomendados

então galera estou com um bug no comando !comprar é o seguinte quando o player compra skill ele ta passando dos 350 de skills está dando pra comprar mais de 350 de skills de club,distance,shield,sword,axe, o unico que está normal é o ml que só vai até 200 os demais estão passando de 350 e queria que o limite deles só fosse 350

 

meu comprar.lua uso tfs 1.1 versão 10.76

 

SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"

local tb = {

    ["sd"] = {t= 1, bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
    ["uh"] = {t= 1, bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
    ["explo"] = {t= 1, bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."},
    ["super divine axe"] = {t= 2, item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
    ["super divine staff"] = {t= 2, item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
    ["super divine club"] = {t= 2, item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
    ["super divine sword"] = {t= 2, item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
    ["super divine crossbow"] = {t= 2, item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
    ["livro nivel 6"] = {t= 2, item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."},
    ["vip10"] = {t= 3, days= 10, price= 5},
    ["vip30"] = {t= 3, days= 30, price= 10},
    ["magiclevel"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL},
    ["skillclub"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 1, incre = 1, skill = SKILL_CLUB},
    ["skillsword"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 1, incre = 1, skill = SKILL_SWORD},
    ["skillaxe"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 1, incre = 1, skill = SKILL_AXE},
    ["skilldistance"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 1, incre = 1, skill = SKILL_DISTANCE},
    ["skillshielding"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 1, incre = 1, skill = SKILL_SHIELD},
    ["magiclevel5"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL},
    ["skillclub10"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 10, incre = 10, skill = SKILL_CLUB},
    ["skillsword10"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 10, incre = 10, skill = SKILL_SWORD},
    ["skillaxe10"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 10, incre = 10, skill = SKILL_AXE},
    ["skilldistance10"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 10, incre = 10, skill = SKILL_DISTANCE},
    ["skillshielding10"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 10, incre = 10, skill = SKILL_SHIELD},
    ["removerfrag"] = {t= 6, price= 10},
}

local storage = 45611

function onSay(player, words, param)

    local pid = player:getGuid()
    local tile = player:getTile()



    if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage("Você precisa está em área protegida para utilizar este comando.")
        return true
    end

    if player:getStorageValue(storage) >= os.time() then
        player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. player:getStorageValue(storage)-os.time() .. " segundos.")
        return true
    end

    if param == "" then
        player:popupFYI("Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
        return true
    end

    for f, v in pairs(tb) do
        if param == f then
            if v.t == 1 then
                if player:getItemCount(9971) >= v.price then
                    local item_quant = (v.bag_quant * 2000)/100
                    for x = 1, v.bag_quant do    
                        local bag = player:addItem(v.bag, 1)
                            for i = 1, item_quant do
                                bag:addItem(v.item, 100)
                            end
                    end
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 2 then
                if player:getItemCount(9971) >= v.price then
                    item = player:addItem(v.item, 1)
                    item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. player:getName() ..". Serial: ".. player:getGuid() ..".")        
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 3 then
                if player:getItemCount(9971) >= v.price then
                    player:addPremiumDays(v.days)
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 4 then
                if player:getBaseMagicLevel() >= v.lim then
                    player:sendCancelMessage(v.lim_msg)
                    return true
                end

                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end

                if player:getItemCount(9971) >= v.price then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 5 then
                if player:getSkillLevel(v.skill) >= v.lim then
                    player:sendCancelMessage("Você não pode ter skill acima de ".. v.lim .. ".")
                    return true
                end

                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end

                if player:getItemCount(9971) >= v.price then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 6 then
                if player:getItemCount(2160) >= v.price then
                    player:removeItem(2160, v.price)
                    player:setSkull(SKULL_NONE)
                    player:setSkullTime(0)
                    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull and frags has been removed!")
                    player:setStorageValue(storage, os.time()+30)
                    db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end    
            end
        end
    end
    
    return false 
end

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

Teste ae ver se da certo. Só mudei essa parte  lim = 200

 

SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"

local tb = {

["sd"] = {t= 1, bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
["uh"] = {t= 1, bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
["explo"] = {t= 1, bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."},
["super divine axe"] = {t= 2, item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
["super divine staff"] = {t= 2, item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
["super divine club"] = {t= 2, item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
["super divine sword"] = {t= 2, item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
["super divine crossbow"] = {t= 2, item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
["livro nivel 6"] = {t= 2, item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."},
["vip10"] = {t= 3, days= 10, price= 5},
["vip30"] = {t= 3, days= 30, price= 10},
["magiclevel"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL},
["skillclub"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 200, price= 1, incre = 1, skill = SKILL_CLUB},
["skillsword"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 200, price= 1, incre = 1, skill = SKILL_SWORD},
["skillaxe"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 200, price= 1, incre = 1, skill = SKILL_AXE},
["skilldistance"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 200, price= 1, incre = 1, skill = SKILL_DISTANCE},
["skillshielding"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 200, price= 1, incre = 1, skill = SKILL_SHIELD},
["magiclevel5"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL},
["skillclub10"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 200, price= 10, incre = 10, skill = SKILL_CLUB},
["skillsword10"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 200, price= 10, incre = 10, skill = SKILL_SWORD},
["skillaxe10"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 200, price= 10, incre = 10, skill = SKILL_AXE},
["skilldistance10"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 200, price= 10, incre = 10, skill = SKILL_DISTANCE},
["skillshielding10"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 200, price= 10, incre = 10, skill = SKILL_SHIELD},
["removerfrag"] = {t= 6, price= 10},
}

local storage = 45611

function onSay(player, words, param)

local pid = player:getGuid()
local tile = player:getTile()



if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
player:sendCancelMessage("Você precisa está em área protegida para utilizar este comando.")
return true
end

if player:getStorageValue(storage) >= os.time() then
player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. player:getStorageValue(storage)-os.time() .. " segundos.")
return true
end

if param == "" then
player:popupFYI("Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
return true
end

for f, v in pairs(tb) do
if param == f then
if v.t == 1 then
if player:getItemCount(9971) >= v.price then
local item_quant = (v.bag_quant * 2000)/100
for x = 1, v.bag_quant do
local bag = player:addItem(v.bag, 1)
for i = 1, item_quant do
bag:addItem(v.item, 100)
end
end
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 2 then
if player:getItemCount(9971) >= v.price then
item = player:addItem(v.item, 1)
item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. player:getName() ..". Serial: ".. player:getGuid() ..".")
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 3 then
if player:getItemCount(9971) >= v.price then
player:addPremiumDays(v.days)
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 4 then
if player:getBaseMagicLevel() >= v.lim then
player:sendCancelMessage(v.lim_msg)
return true
end

if not isInArray(v.vocations, player:getVocation():getId()) then
player:sendCancelMessage(v.voc_msg)
return true
end

if player:getItemCount(9971) >= v.price then
player:removeItem(9971, v.price)
player:setStorageValue(storage, os.time()+30)
player:remove()
db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 5 then
if player:getSkillLevel(v.skill) >= v.lim then
player:sendCancelMessage("Você não pode ter skill acima de ".. v.lim .. ".")
return true
end

if not isInArray(v.vocations, player:getVocation():getId()) then
player:sendCancelMessage(v.voc_msg)
return true
end

if player:getItemCount(9971) >= v.price then
player:removeItem(9971, v.price)
player:setStorageValue(storage, os.time()+30)
player:remove()
db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 6 then
if player:getItemCount(2160) >= v.price then
player:removeItem(2160, v.price)
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull and frags has been removed!")
player:setStorageValue(storage, os.time()+30)
db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end

Link para o post
Compartilhar em outros sites

cara você colocou todos lim 200 praticamente não mudou nada só os números e o limite de 200 é só do magiclevel que já tava certo só os demais que estão com erro. 

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

Tente ae

 

 

SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"

local tb = {

["sd"] = {t= 1, bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
["uh"] = {t= 1, bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
["explo"] = {t= 1, bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."},
["super divine axe"] = {t= 2, item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
["super divine staff"] = {t= 2, item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
["super divine club"] = {t= 2, item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
["super divine sword"] = {t= 2, item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
["super divine crossbow"] = {t= 2, item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
["livro nivel 6"] = {t= 2, item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."},
["vip10"] = {t= 3, days= 10, price= 5},
["vip30"] = {t= 3, days= 30, price= 10},
["magiclevel"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", v.lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL},
["skillclub"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", v.lim = 350, price= 1, incre = 1, skill = SKILL_CLUB},
["skillsword"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", v.lim = 350, price= 1, incre = 1, skill = SKILL_SWORD},
["skillaxe"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", v.lim = 350, price= 1, incre = 1, skill = SKILL_AXE},
["skilldistance"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", v.lim = 350, price= 1, incre = 1, skill = SKILL_DISTANCE},
["skillshielding"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", v.lim = 350, price= 1, incre = 1, skill = SKILL_SHIELD},
["magiclevel5"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", v.lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL},
["skillclub10"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", v.lim = 350, price= 10, incre = 10, skill = SKILL_CLUB},
["skillsword10"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", v.lim = 350, price= 10, incre = 10, skill = SKILL_SWORD},
["skillaxe10"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", v.lim = 350, price= 10, incre = 10, skill = SKILL_AXE},
["skilldistance10"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", v.lim = 350, price= 10, incre = 10, skill = SKILL_DISTANCE},
["skillshielding10"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", v.lim = 350, price= 10, incre = 10, skill = SKILL_SHIELD},
["removerfrag"] = {t= 6, price= 10},
}

local storage = 45611

function onSay(player, words, param)

local pid = player:getGuid()
local tile = player:getTile()



if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
player:sendCancelMessage("Você precisa está em área protegida para utilizar este comando.")
return true
end

if player:getStorageValue(storage) >= os.time() then
player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. player:getStorageValue(storage)-os.time() .. " segundos.")
return true
end

if param == "" then
player:popupFYI("Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
return true
end

for f, v in pairs(tb) do
if param == f then
if v.t == 1 then
if player:getItemCount(9971) >= v.price then
local item_quant = (v.bag_quant * 2000)/100
for x = 1, v.bag_quant do
local bag = player:addItem(v.bag, 1)
for i = 1, item_quant do
bag:addItem(v.item, 100)
end
end
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 2 then
if player:getItemCount(9971) >= v.price then
item = player:addItem(v.item, 1)
item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. player:getName() ..". Serial: ".. player:getGuid() ..".")
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 3 then
if player:getItemCount(9971) >= v.price then
player:addPremiumDays(v.days)
player:removeItem(9971, v.price)
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
player:setStorageValue(storage, os.time()+30)
break
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 4 then
if player:getBaseMagicLevel() >= v.lim then
player:sendCancelMessage(v.lim_msg)
return true
end

if not isInArray(v.vocations, player:getVocation():getId()) then
player:sendCancelMessage(v.voc_msg)
return true
end

if player:getItemCount(9971) >= v.price then
player:removeItem(9971, v.price)
player:setStorageValue(storage, os.time()+30)
player:remove()
db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 5 then
if player:getSkillLevel(v.skill) >= v.lim then
player:sendCancelMessage("Você não pode ter skill acima de ".. v.lim .. ".")
return true
end

if not isInArray(v.vocations, player:getVocation():getId()) then
player:sendCancelMessage(v.voc_msg)
return true
end

if player:getItemCount(9971) >= v.price then
player:removeItem(9971, v.price)
player:setStorageValue(storage, os.time()+30)
player:remove()
db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
elseif v.t == 6 then
if player:getItemCount(2160) >= v.price then
player:removeItem(2160, v.price)
player:setSkull(SKULL_NONE)
player:setSkullTime(0)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull and frags has been removed!")
player:setStorageValue(storage, os.time()+30)
db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
else
player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
end
end
end
end

return false
end

Link para o post
Compartilhar em outros sites

não funcionou deu erro expected near  ' = '  lembrando que é tfs 1.1 versão 10.76 o script ta pronto unico problema é que está passando de 350 de skills e  o limite é 350 só o magic level que está certo que é 200 o máximo 

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

não acho que seja nas sources pois no script do 8.60 que tinha era no script mesmo

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

quem fez esse script?? pra que usar ipairs?? usa tabble...

ex:

if not tb[param:lower()] then
player:sendCancelMessage("este item ou skill n existe.") return true
end
local var = tb[param:lower()]
if var.t == 1 then
...
end
---------------------------
 
tenta usar assim:
SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"
local tb = {
 
    ["sd"] = {t= 1, bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
    ["uh"] = {t= 1, bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
    ["explo"] = {t= 1, bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."},
    ["super divine axe"] = {t= 2, item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
    ["super divine staff"] = {t= 2, item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
    ["super divine club"] = {t= 2, item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
    ["super divine sword"] = {t= 2, item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
    ["super divine crossbow"] = {t= 2, item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
    ["livro nivel 6"] = {t= 2, item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."},
    ["vip10"] = {t= 3, days= 10, price= 5},
    ["vip30"] = {t= 3, days= 30, price= 10},
    ["magiclevel"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL},
    ["skillclub"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 1, incre = 1, skill = SKILL_CLUB},
    ["skillsword"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 1, incre = 1, skill = SKILL_SWORD},
    ["skillaxe"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 1, incre = 1, skill = SKILL_AXE},
    ["skilldistance"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 1, incre = 1, skill = SKILL_DISTANCE},
    ["skillshielding"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 1, incre = 1, skill = SKILL_SHIELD},
    ["magiclevel5"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL},
    ["skillclub10"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 10, incre = 10, skill = SKILL_CLUB},
    ["skillsword10"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 10, incre = 10, skill = SKILL_SWORD},
    ["skillaxe10"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 10, incre = 10, skill = SKILL_AXE},
    ["skilldistance10"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 10, incre = 10, skill = SKILL_DISTANCE},
    ["skillshielding10"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 10, incre = 10, skill = SKILL_SHIELD},
    ["removerfrag"] = {t= 6, price= 10},
}
 
local storage = 45611
 
function onSay(player, words, param)
 
    local pid = player:getGuid()
    local tile = player:getTile()
 
 
 
    if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage("Você precisa está em área protegida para utilizar este comando.")
        return true
    end
 
    if player:getStorageValue(storage) >= os.time() then
        player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. player:getStorageValue(storage)-os.time() .. " segundos.")
        return true
    end
 
    if param == "" then
        player:popupFYI("Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
        return true
    end
 
    for f, v in pairs(tb) do
        if param == f then
            if v.t == 1 then
                if player:getItemCount(9971) >= v.price then
                    local item_quant = (v.bag_quant * 2000)/100
                    for x = 1, v.bag_quant do    
                        local bag = player:addItem(v.bag, 1)
                            for i = 1, item_quant do
                                bag:addItem(v.item, 100)
                            end
                    end
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 2 then
                if player:getItemCount(9971) >= v.price then
                    item = player:addItem(v.item, 1)
                    item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. player:getName() ..". Serial: ".. player:getGuid() ..".")        
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 3 then
                if player:getItemCount(9971) >= v.price then
                    player:addPremiumDays(v.days)
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 4 then
                if player:getBaseMagicLevel() >= v.lim then
                    player:sendCancelMessage(v.lim_msg)
                    return true
                end
 
                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end
 
                if player:getItemCount(9971) >= v.price then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 5 then
                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end
                if player:getSkillLevel(v.skill) >= v.lim or player:getSkillLevel(v.skill) > (v.lim-1) then
                  player:sendCancelMessage("Você não pode ter skill acima de ".. v.lim .. ".") return true
                end
                if player:getItemCount(9971) >= v.price then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 6 then
                if player:getItemCount(2160) >= v.price then
                    player:removeItem(2160, v.price)
                    player:setSkull(SKULL_NONE)
                    player:setSkullTime(0)
                    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull and frags has been removed!")
                    player:setStorageValue(storage, os.time()+30)
                    db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end    
            end
        end
    end
    
    return false 
end
Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Vodkart quando estou comprando magic level está dando esse erro.

1b2ee4dae5cf1a9880cfdff89446ce6edd0e2bbb

 

não só o do magic level como dos outros como sword etc

 

320974ef324ef2bee01f84890942b8843dfe1ca0

Editado por JonatasLucasf (veja o histórico de edições)

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

Link para o post
Compartilhar em outros sites

editei o script, tenta usar de novo

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Vodkart  o erro sumiu mais o personagem mesmo depois do skills 350 continua comprando, só o magic level está correto.

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

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

SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"
local tb = {
    ["sd"] = {t= 1, bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
    ["uh"] = {t= 1, bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
    ["explo"] = {t= 1, bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."},
    ["super divine axe"] = {t= 2, item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
    ["super divine staff"] = {t= 2, item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
    ["super divine club"] = {t= 2, item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
    ["super divine sword"] = {t= 2, item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
    ["super divine crossbow"] = {t= 2, item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
    ["livro nivel 6"] = {t= 2, item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."},
    ["vip10"] = {t= 3, days= 10, price= 5},
    ["vip30"] = {t= 3, days= 30, price= 10},
    ["magiclevel"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 3, incre = 1, skill = SKILL_MAGLEVEL, skill_id = 7},
    ["skillclub"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 1, incre = 1, skill = SKILL_CLUB, skill_id = 1},
    ["skillsword"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 1, incre = 1, skill = SKILL_SWORD, skill_id = 2},
    ["skillaxe"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 1, incre = 1, skill = SKILL_AXE, skill_id = 3},
    ["skilldistance"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 1, incre = 1, skill = SKILL_DISTANCE, skill_id = 4},
    ["skillshielding"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 1, incre = 1, skill = SKILL_SHIELD, skill_id = 5},
    ["magiclevel5"] = {t= 4, vocations = {1, 5, 2, 6, 11, 12}, voc_msg= "Somente Sorcerers, Druids e Infernalists podem comprar magic level.", lim = 200, lim_msg = "Você não pode ter magic level acima de 200.", price= 15, incre = 5, skill = SKILL_MAGLEVEL, skill_id = 7},
    ["skillclub10"] = {t= 5, vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, price= 10, incre = 10, skill = SKILL_CLUB, skill_id = 1},
    ["skillsword10"] = {t= 5, vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, price= 10, incre = 10, skill = SKILL_SWORD, skill_id = 2},
    ["skillaxe10"] = {t=5 , vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350, price= 10, incre = 10, skill = SKILL_AXE, skill_id = 3},
    ["skilldistance10"] = {t= 5, vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350, price= 10, incre = 10, skill = SKILL_DISTANCE, skill_id = 4},
    ["skillshielding10"] = {t= 5, vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, price= 10, incre = 10, skill = SKILL_SHIELD, skill_id = 5},
    ["removerfrag"] = {t= 6, price= 10},
}
 
local storage = 45611
 
function onSay(player, words, param)
 
    local pid = player:getGuid()
    local tile = player:getTile()
 
 
 
    if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage("Você precisa está em área protegida para utilizar este comando.")
        return true
    end
 
    if player:getStorageValue(storage) >= os.time() then
        player:sendCancelMessage("Por medidas de segurança você só pode utilizar este comando em " .. player:getStorageValue(storage)-os.time() .. " segundos.")
        return true
    end
 
    if param == "" then
        player:popupFYI("Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100k.\nO Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
        return true
    end
 
    for f, v in pairs(tb) do
        if param == f then
            if v.t == 1 then
                if player:getItemCount(9971) >= v.price then
                    local item_quant = (v.bag_quant * 2000)/100
                    for x = 1, v.bag_quant do    
                        local bag = player:addItem(v.bag, 1)
                            for i = 1, item_quant do
                                bag:addItem(v.item, 100)
                            end
                    end
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 2 then
                if player:getItemCount(9971) >= v.price then
                    item = player:addItem(v.item, 1)
                    item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. player:getName() ..". Serial: ".. player:getGuid() ..".")        
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 3 then
                if player:getItemCount(9971) >= v.price then
                    player:addPremiumDays(v.days)
                    player:removeItem(9971, v.price)
                    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
                    player:setStorageValue(storage, os.time()+30)
                    break
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 4 then
                if player:getBaseMagicLevel() >= v.lim then
                    player:sendCancelMessage(v.lim_msg)
                    return true
                end
 
                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end
 
                if player:getItemCount(9971) >= v.price then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 5 then
                if not isInArray(v.vocations, player:getVocation():getId()) then
                    player:sendCancelMessage(v.voc_msg)
                    return true
                end
                if player:getItemCount(9971) >= v.price then
                 if player:getSkillLevel(v.skill_id) < v.lim then
                    player:removeItem(9971, v.price)
                    player:setStorageValue(storage, os.time()+30)
                    player:remove()
                    db.query("UPDATE `players` SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE `id` = ".. pid)
                    else
                 player:sendCancelMessage("Você não pode ter skill acima de ".. v.lim .. ".")
                end
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end
            elseif v.t == 6 then
                if player:getItemCount(2160) >= v.price then
                    player:removeItem(2160, v.price)
                    player:setSkull(SKULL_NONE)
                    player:setSkullTime(0)
                    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your skull and frags has been removed!")
                    player:setStorageValue(storage, os.time()+30)
                    db.query("UPDATE `player_deaths` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `killed_by` = " .. db.escapeString(player:getName()))
                else
                    player:sendCancelMessage("Você não possui a quantidade necessária para comprar.")
                end    
            end
        end
    end
    
    return false 
end
Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

muito obrigado funcionou 100%

ca.png?1422745283

 

CONQUISTASdesigner-king.png   Designer.png    

 

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