• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ [Error - mysql_real_query] Query: UPDATE players

vitorelias1

New Member
Joined
Sep 27, 2022
Messages
27
Reaction score
2
hello guys!

I have a talkaction on my server example

!buy skillmagiclevel

Before it was working, I don't know what I did and now when I use the command it returns this message in the console and doesn't add the skill.

I don't know what it could be, I already deleted the database, downloaded another one and still the error continues

TFS .12
1697141142329.png

buy.lua

Lua:
SKILL_CLUB = "skill_club"
SKILL_DISTANCE = "skill_dist"
SKILL_SHIELD = "skill_shielding"
SKILL_MAGLEVEL = "maglevel"
SKILL_SWORD = "skill_sword"
SKILL_AXE = "skill_axe"
local storage = 45611
local coinID = 9971 -- moeda para comprar skills

local runas = {
    ["sd"] = {bag = 5926, item= 2268, bag_quant = 2, price= 50, msg= "Parabéns você comprou 4k de SD com sucesso."},
    ["uh"] = {bag = 2002, item= 2273, bag_quant = 3, price= 30, msg= "Parabéns você comprou 6k de UH com sucesso."},
    ["explo"] = {bag = 2001, item= 2313, bag_quant = 3, price= 10, msg= "Parabéns você comprou 6k de Explosion com sucesso."}
}
local itens = {
    ["super divine axe"] = {item = 8926, price= 60, msg= "Você comprou um super divine axe com sucesso."},
    ["super divine staff"] = {item = 8922, price= 60, msg= "Você comprou um super divine staff com sucesso."},
    ["super divine club"] = {item = 7423, price= 60, msg= "Você comprou um super divine club com sucesso."},
    ["super divine sword"] = {item = 7403, price= 60, msg= "Você comprou um super divine sword com sucesso."},
    ["super divine crossbow"] = {item = 8851, price= 60, msg= "Você comprou um super divine crossbow com sucesso."},
    ["livro nivel 6"] = {item = 8921, price= 60, msg= "Você comprou um livro nivel 6 com sucesso."}
}
local vip = {
    ["vip10"] = {days= 10, price= 5},
    ["vip30"] = {days= 30, price= 10}
}

local skills = {
    ["magiclevel"] = {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 = 7},
    ["skillclub"] = {vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 1, incre = 1, skill = 1},
    ["skillsword"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 1, incre = 1, skill = 2},
    ["skillaxe"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350,lim_msg = "Você não pode ter skill axe acima de 350.", price= 1, incre = 1, skill = 3},
    ["skilldistance"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350,lim_msg = "Você não pode ter skill distance acima de 350.", price= 1, incre = 1, skill = 4},
    ["skillshielding"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 1, incre = 1, skill = 5},
    ["magiclevel5"] = {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 = 7},
    ["skillclub10"] = {vocations = {9, 10}, voc_msg= "Somente Drunous podem comprar skill de club.", lim = 350, lim_msg = "Você não pode ter skill club acima de 350.", price= 10, incre = 10, skill = 1},
    ["skillsword10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de sword.", lim = 350, lim_msg = "Você não pode ter skill sword acima de 350.", price= 10, incre = 10, skill = 2},
    ["skillaxe10"] = {vocations = {4, 8}, voc_msg= "Somente Knights podem comprar skill de axe.", lim = 350,lim_msg = "Você não pode ter skill axe acima de 350.", price= 10, incre = 10, skill = 3},
    ["skilldistance10"] = {vocations = {3, 7}, voc_msg= "Somente Paladins podem comprar skill de distance.", lim = 350,lim_msg = "Você não pode ter skill distance acima de 350.", price= 10, incre = 10, skill = 4},
    ["skillshielding10"] = {vocations = {3, 7, 4, 8, 9, 10}, voc_msg= "Somente Paladins, Knights e Drunous podem comprar skill de shield.", lim = 350, lim_msg = "Você não pode ter skill shielding acima de 350.", price= 10, incre = 10, skill = 5},
}

local frags = {
    ["removerfrag"] = {price= 10}
}

local montarias = {
     ["montaria shadow draptor"] = {price = 30, id = 24, storage = 87801},
     ["montaria golden lion"] = {price = 30, id = 41, storage = 87802},
     ["montaria winter king"] = {price = 30, id = 52, storage = 87803},
     ["montaria flying divan"] = {price = 30, id = 65, storage = 87804},
     ["montaria woodland prince"] = {price = 30, id = 54, storage = 87805},
     ["montaria black stag"] = {price = 30, id = 73, storage = 87806},
     ["montaria nether steed"] = {price = 30, id = 50, storage = 87807},
     ["montaria snow pelt"] = {price = 30, id = 102, storage = 87808},
     ["montaria slagsnare"] = {price = 30, id = 84, storage = 87809},
     ["montaria sea devil"] = {price = 55, id = 78, storage = 87810},
     ["montaria highland yak"] = {price = 75, id = 63, storage = 87811},
     ["montaria copper fly"] = {price = 60, id = 61, storage = 87812},
     ["montaria bloodcurl"] = {price = 92, id = 24, storage = 87813},
     ["montaria poisonbane"] = {price = 65, id = 57, storage = 87814},
     ["montaria razorcreep"] = {price = 75, id = 86, storage = 87815},
     ["montaria noctungra"] = {price = 70, id = 82, storage = 87816},
     ["montaria leafscuttler"] = {price = 75, id = 93, storage = 87817},
     ["montaria jade pincer"] = {price = 60, id = 49, storage = 87819},
     ["frostflare"] = {price = 30, id = 89, storage = 87820}

}   

local outfits = {
      ["roupa ceremonial garb"] = {price = 30, id = {[0] = 694, [1] = 695}}
      }



function onSay(player, words, param)
    local player = Player(player)
    local pid = player:getGuid()
    local tile = player:getTile()
    local param = param:lower()   
    if not tile:hasFlag(TILESTATE_PROTECTIONZONE) then
        player:sendCancelMessage("Você precisa estar 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:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "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.\nmontaria shadow draptor = montaria shadow draptor por 30 barras.\nmontaria golden lion = montaria golden lion por 30 barras.\nmontaria winter king = montaria winter king por 30 barras.\nmontaria flying divan = montaria flying divan por 30 barras.\nmontaria woodland prince = montaria woodland prince por 30 barras.\nmontaria black stag = montaria black stag por 30 barras.\nmontaria nether steed = montaria nether steed por 30 barras.\nmontaria snow pelt = montaria snow pelt por 30 barras.\nmontaria slagsnare = montaria slagsnare por 30 barras.\nmontaria sea devil = montaria sea devil por 55 barras.\nmontaria highland yak = montaria highland yak por 75 barras.\nmontaria copper fly = montaria copper fly por 60 barras.\nmontaria bloodcurl = montaria bloodcurl por 70 barras.\nmontaria poisonbane = montaria poisonbane por 65 barras.\nmontaria razorcreep = montaria razorcreep por 75 barras.\nmontaria noctungra = montaria noctungra por 70 barras.\nmontaria leafscuttler = montaria leafscuttler por 75 barras.\nmontaria jade pincer = montaria jade pincer por 60 barras.\nmontaria frostflare = montaria frostflare por 85 barras.\nroupa ceremonial garb = roupa ceremonial garb todos addons por 30 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
    if runas[param] then
        local v = runas[param]
        if player:getItemCount(coinID) >= 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(coinID, v.price)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
            player:setStorageValue(storage, os.time()+1)
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
        end
        return true
    end
    if itens[param] then
        local v = itens[param]
        if player:getItemCount(coinID) >= 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(coinID, v.price)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, v.msg)
            player:setStorageValue(storage, os.time()+1)
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
        end
        return true
    end
    if vip[param] then
        local v = vip[param]
        if player:getItemCount(coinID) >= v.price then
            player:addPremiumDays(v.days)
            player:removeItem(coinID, v.price)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Parabéns você comprou " .. v.days .. " dias de vip com sucesso.")
            player:setStorageValue(storage, os.time()+1)
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
        end
        return true
    end   
    if skills[param] then
        local v = skills[param]
        if param == "magiclevel" and player:getBaseMagicLevel() >= v.lim or (player:getBaseMagicLevel() + v.incre ) >= v.lim then
            player:sendCancelMessage(v.lim_msg) return true
        elseif player:getSkillLevel(v.skill) + v.incre >= v.lim then
            print("oooooookay") -- aquu tem que parar o codigo
            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(coinID) >= v.price then
            player:removeItem(coinID, v.price)
            player:setStorageValue(storage, os.time()+1)
            player:remove()
            db.query("UPDATE players SET ".. v.skill .. " = " .. v.skill .. " + " .. v.incre .. " WHERE id = ".. pid)
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
        end
        return true
    end
    if frags[param] then
        local v = frags[param]
        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()+1)
            db.query("UPDATE player_deaths SET unjustified = 0 WHERE unjustified = 1 AND killed_by = " .. db.escapeString(player:getName()))
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
        end
        return true
    end
if montarias[param] then   
    local v = montarias[param]   
    if player:getStorageValue(v.storage) > 0 then
        player:sendCancelMessage("voce ja possui essa montaria.") return true
    end
    if player:getItemCount(coinID) >= v.price then
        player:setStorageValue(v.storage, 1)   
        player:removeItem(coinID, v.price)
        player:addMount(v.id)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
    end
    return true
end

if outfits[param] then
    local v = outfits[param]
    local sex = v.id[player:getSex()]
    if player:hasOutfit(sex, 1) then
        player:sendCancelMessage("voce ja possui essa outfit.") return true
    end
    if player:getItemCount(coinID) >= v.price then   
        player:removeItem(coinID, v.price)
        p:addOutfitAddon(sex, 1)
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_RED, "Você não possui a quantidade necessária para comprar.")
    end
    return true
end

    return true
end
 
Back
Top