Ir para conteúdo
  • 0

-=[TFS]=- 0.3.6 - 8.60 TO COM PROBLEMA NO MOD marketchar.xml Characters Market System comando !character list não funciona.


Muvuka

Pergunta

TO COM PROBLEMA NESSE SCRIPT MOD


[01/07/2024 04:46:40] [Error - TalkAction Interface] 
[01/07/2024 04:46:40] buffer
[01/07/2024 04:46:40] Description: 
[01/07/2024 04:46:40] [string "price = 27112..."]:26: attempt to concatenate a nil value

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 717217 -- Level min of character.--
min_price = 10000000000000 -- Price min of character--
max_price = 10000000000000 -- Price maximum of character--
 
function doTransferCharacter(cid, accId)
        return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
        return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
        local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
        if result:getID() == -1 then
                return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
        else
                result:free()
                return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
        end
end
 
function getOfflinePlayerStorageValue(name, key)
        local result, ret = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
        if result:getID() == -1 then
                return nil
        end
        ret = result:getDataInt("value")
        result:free()
        return ret
end
 
function getOfflinePlayerValue(name, value)
        local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
        ret = result:getDataInt(value)
        result:free()
        return ret
end
 
function isCharacterForSale(name)
        if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
        return false
        else
        return true
        end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
        local t = string.explode(param, ",")
       
        if t[1] == "sell" then
                if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
                elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
                elseif isCharacterForSale(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
                elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
                elseif getPlayerByName(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
                elseif getOfflinePlayerValue(t[2], "level") < level then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
                elseif tonumber(t[3]) < min_price then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
                elseif tonumber(t[3]) > max_price then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
                end
       
                        setOfflinePlayerStorageValue(t[2], price, t[3])
                        setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" gold coins.')
        elseif t[1] == "buy" then
                if not t[2] then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
                elseif not playerExists(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
                elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
                elseif not isCharacterForSale(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
                elseif not doPlayerRemoveMoney(cid, getOfflinePlayerStorageValue(t[2], price)) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough money. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." gold coins.") return true
                end
                       
                if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
                        doOfflinePlayerAddMoney(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), getOfflinePlayerStorageValue(t[2], price))
                        setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
                else
                        doPlayerAddMoney(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), getOfflinePlayerStorageValue(t[2], price))
                        doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' gold coins.')
                end
                        doTransferCharacter(t[2], getPlayerAccountId(cid))
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' gold coins.')
                        setOfflinePlayerStorageValue(t[2], owner, -1)
                        setOfflinePlayerStorageValue(t[2], price, -1) return true
        elseif t[1] == "remove" then
                if not t[2] then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
                elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
                elseif not isCharacterForSale(t[2]) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
                end
               
                        setOfflinePlayerStorageValue(t[2], price, -1)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
        elseif t[1] == "list" then
                local result = db.getResult("SELECT `name` FROM `players`")
                if result:getID() == -1 then
                        return true
                end
                local msg = "Characters for Sale:\n\n"
                while true do
                        local name = result:getDataString("name")
                        if isCharacterForSale(name) then
                        local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
                                msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
                        end
                        if not result:next() then
                                break
                        end
                end
                        doPlayerPopupFYI(cid, msg) return true
        elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
        end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
        if getPlayerStorageValue(cid, price) > 0 then return false
        elseif getPlayerStorageValue(cid, 41792) ~= -1 then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The money is in your bank account.")
                setPlayerStorageValue(cid, 41792, -1)
        end
return true
end
]]></event>
</mod>

 

Editado por Muvuka
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 1

Os erros indicam que a função getPlayerGUIDByName está retornando nil para os nomes de personagens fornecidos. Isso pode ocorrer devido a vários motivos, como o personagem não existir na base de dados, erros de sintaxe nos nomes dos personagens, ou problemas de conexão com o banco de dados.

Vamos ajustar o script para lidar melhor com esses casos e garantir que a função getPlayerGUIDByName esteja retornando valores corretos ou tratando os erros adequadamente. Vou também adicionar mais debug prints para ajudar a identificar a causa exata dos problemas.

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 717217 -- Level min of character. --
min_price = 10000000000000 -- Price min of character --
max_price = 10000000000000 -- Price maximum of character --

function doTransferCharacter(cid, accId)
    local playerGUID = getPlayerGUIDByName(cid)
    print("doTransferCharacter - Player GUID for", cid, "is", playerGUID)
    if playerGUID then
        return db.executeQuery("UPDATE `players` SET `account_id` = " .. accId .. " WHERE `id` = " .. playerGUID)
    else
        print("Error: Player GUID for " .. cid .. " is nil.")
        return false
    end
end

function doOfflinePlayerAddMoney(guid, money)
    local playerGUID = getPlayerGUIDByName(guid)
    print("doOfflinePlayerAddMoney - Player GUID for", guid, "is", playerGUID)
    if playerGUID then
        return db.executeQuery("UPDATE `players` SET `balance` = `balance` + " .. money .. " WHERE `id` = " .. playerGUID .. ";")
    else
        print("Error: Player GUID for " .. guid .. " is nil.")
        return false
    end
end

function setOfflinePlayerStorageValue(name, key, value)
    local playerGUID = getPlayerGUIDByName(name)
    print("setOfflinePlayerStorageValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        if result:getID() == -1 then
            print("setOfflinePlayerStorageValue - No existing storage value found, inserting new value")
            return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. playerGUID .. ", " .. key .. ", " .. value .. ");")
        else
            result:free()
            print("setOfflinePlayerStorageValue - Existing storage value found, updating value")
            return db.executeQuery("UPDATE `player_storage` SET `value` = " .. value .. " WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        end
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return false
    end
end

function getOfflinePlayerStorageValue(name, key)
    local playerGUID = getPlayerGUIDByName(name)
    print("getOfflinePlayerStorageValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        if result:getID() == -1 then
            print("getOfflinePlayerStorageValue - No storage value found for", name, "with key", key)
            return nil
        end
        local ret = result:getDataInt("value")
        print("getOfflinePlayerStorageValue - Retrieved storage value for", name, "with key", key, "is", ret)
        result:free()
        return ret
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return nil
    end
end

function getOfflinePlayerValue(name, value)
    local playerGUID = getPlayerGUIDByName(name)
    print("getOfflinePlayerValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT `" .. value .. "` FROM `players` WHERE `id` = " .. playerGUID .. ";")
        if result:getID() == -1 then
            print("getOfflinePlayerValue - No value found for", name, "with field", value)
            return nil
        end
        local ret = result:getDataInt(value)
        print("getOfflinePlayerValue - Retrieved value for", name, "with field", value, "is", ret)
        result:free()
        return ret
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return nil
    end
end

function isCharacterForSale(name)
    local playerGUID = getPlayerGUIDByName(name)
    print("isCharacterForSale - Player GUID for", name, "is", playerGUID)
    if playerGUID and getOfflinePlayerStorageValue(name, price) and getOfflinePlayerStorageValue(name, price) > 0 then
        return true
    else
        return false
    end
end
]]></config>

<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
    local t = string.explode(param, ",")
    
    if t[1] == "sell" then
        if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
        elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
        elseif isCharacterForSale(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
        elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
        elseif getPlayerByName(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
        elseif getOfflinePlayerValue(t[2], "level") < level then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
        elseif tonumber(t[3]) < min_price then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
        elseif tonumber(t[3]) > max_price then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
        end
        
        setOfflinePlayerStorageValue(t[2], price, t[3])
        setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" gold coins.')
    elseif t[1] == "buy" then
        if not t[2] then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
        elseif not playerExists(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
        elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
        elseif not isCharacterForSale(t[2]) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
        elseif not doPlayerRemoveMoney(cid, getOfflinePlayerStorageValue(t[2], price)) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough money. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." gold coins.") return true
        end
        
        if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
            doOfflinePlayerAddMoney(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), getOfflinePlayerStorageValue(t[2], price))
            setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
        else
            doPlayerAddMoney(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), getOfflinePlayerStorageValue(t[2], price))
        end
        
        doTransferCharacter(t[2], getPlayerAccountId(cid))
        setOfflinePlayerStorageValue(t[2], price, 0)
        setOfflinePlayerStorageValue(t[2], owner, 0)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have bought the character "'..t[2]..'" for "'..getOfflinePlayerStorageValue(t[2], price)..'" gold coins.')
    elseif t[1] == "list" then
        doPlayerPopupFYI(cid, "Houses for sale")
    end
return true
]]></talkaction>
</mod>

 

Link para o comentário
Compartilhar em outros sites

  • 0
EU USEI PRINT NO CODIDO UM POR CADA UM E APARECEU ISSO NO CONSOLE
[01/07/2024 06:17:50] Error: Could not get player GUID for character Harkaricus
[01/07/2024 06:17:51] Error: Could not get player GUID for character Chera Xana
[01/07/2024 06:17:51] Error: Could not get player GUID for character Avalost
[01/07/2024 06:17:51] Error: Could not get player GUID for character Mirkwin Aki
[01/07/2024 06:17:51] Error: Could not get player GUID for character Menezinho foda
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude ate esquentar
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fuder ate respawnar
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude falando
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude opeitorosado
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude os Nascimento
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude ate raiar
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude ate criar
[01/07/2024 06:17:51] Error: Could not get player GUID for character Fude bugando
[01/07/2024 06:17:51] Error: Could not get player GUID for character Yrapuru
[01/07/2024 06:17:51] Error: Could not get player GUID for character Xxt'zaao
[01/07/2024 06:17:51] Error: Could not get player GUID for character Mc Donalds
[01/07/2024 06:17:51] Error: Could not get player GUID for character Otome
[01/07/2024 06:17:51] Error: Could not get player GUID for character Linkin Har
[01/07/2024 06:17:51] Error: Could not get player GUID for character Morte Pala Pes
[01/07/2024 06:17:51] Error: Could not get player GUID for character Rozinx
[01/07/2024 06:17:51] Error: Could not get player GUID for character Vibud
[01/07/2024 06:17:51] Error: Could not get player GUID for character Maurolkit
[01/07/2024 06:17:52] Error: Could not get player GUID for character Lucifer
[01/07/2024 06:17:52] Error: Could not get player GUID for character Hammer
[01/07/2024 06:17:52] Error: Could not get player GUID for character Aeropostale
[01/07/2024 06:17:52] Error: Could not get player GUID for character Vladimir
[01/07/2024 06:17:53] Error: Could not get player GUID for character Jivelin'o
[01/07/2024 06:17:53] Error: Could not get player GUID for character Queen Of Darkness
[01/07/2024 06:17:53] Error: Could not get player GUID for character Female
[01/07/2024 06:17:53] Error: Could not get player GUID for character Born
[01/07/2024 06:17:54] Error: Could not get player GUID for character Druidzinha
[01/07/2024 06:17:54] Error: Could not get player GUID for character Hill
[01/07/2024 06:17:54] Error: Could not get player GUID for character Shazam
[01/07/2024 06:17:54] Error: Could not get player GUID for character Mage The Hell
[01/07/2024 06:17:54] Error: Could not get player GUID for character Lirmex
[01/07/2024 06:17:55] Error: Could not get player GUID for character Madrugah
[01/07/2024 06:17:55] Error: Could not get player GUID for character Luan
[01/07/2024 06:17:55] Error: Could not get player GUID for character Killer Druid
[01/07/2024 06:17:55] Error: Could not get player GUID for character Lord'pala
[01/07/2024 06:17:56] Error: Could not get player GUID for character Mahogannyy
[01/07/2024 06:17:56] Error: Could not get player GUID for character Vickk
[01/07/2024 06:17:57] Error: Could not get player GUID for character Jockbk
[01/07/2024 06:17:57] Error: Could not get player GUID for character Jocksm
[01/07/2024 06:17:58] Error: Could not get player GUID for character Holy
[01/07/2024 06:17:59] Error: Could not get player GUID for character Geen Arrow
[01/07/2024 06:18:01] Error: Could not get player GUID for character Lerdo
[01/07/2024 06:18:01] Error: Could not get player GUID for character Doldorn
[01/07/2024 06:18:01] Error: Could not get player GUID for character Nyarix
[01/07/2024 06:18:01] Error: Could not get player GUID for character Kirigaya Kazuto
[01/07/2024 06:18:01] Error: Could not get player GUID for character Paladin Dislexico
[01/07/2024 06:18:01] Error: Could not get player GUID for character Arranha Ceu
[01/07/2024 06:18:02] Error: Could not get player GUID for character Pancheri
[01/07/2024 06:18:02] Error: Could not get player GUID for character Dieghoul
[01/07/2024 06:18:05] Error: Could not get player GUID for character Mage Crrupt
[01/07/2024 06:18:05] Error: Could not get player GUID for character Gostoza
[01/07/2024 06:18:06] Error: Could not get player GUID for character Home Viu
[01/07/2024 06:18:07] Error: Could not get player GUID for character Pepinto

 

 

function doTransferCharacter(cid, accId)
    local playerGUID = getPlayerGUIDByName(cid)
    print("doTransferCharacter - Player GUID for", cid, "is", playerGUID)
    if playerGUID then
        return db.executeQuery("UPDATE `players` SET `account_id` = " .. accId .. " WHERE `id` = " .. playerGUID)
    else
        print("Error: Player GUID for " .. cid .. " is nil.")
        return false
    end
end

function doOfflinePlayerAddMoney(guid, money)
    local playerGUID = getPlayerGUIDByName(guid)
    print("doOfflinePlayerAddMoney - Player GUID for", guid, "is", playerGUID)
    if playerGUID then
        return db.executeQuery("UPDATE `players` SET `balance` = `balance` + " .. money .. " WHERE `id` = " .. playerGUID .. ";")
    else
        print("Error: Player GUID for " .. guid .. " is nil.")
        return false
    end
end

function setOfflinePlayerStorageValue(name, key, value)
    local playerGUID = getPlayerGUIDByName(name)
    print("setOfflinePlayerStorageValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        if result:getID() == -1 then
            print("setOfflinePlayerStorageValue - No existing storage value found, inserting new value")
            return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (" .. playerGUID .. ", " .. key .. ", " .. value .. ");")
        else
            result:free()
            print("setOfflinePlayerStorageValue - Existing storage value found, updating value")
            return db.executeQuery("UPDATE `player_storage` SET `value` = " .. value .. " WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        end
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return false
    end
end

function getOfflinePlayerStorageValue(name, key)
    local playerGUID = getPlayerGUIDByName(name)
    print("getOfflinePlayerStorageValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = " .. playerGUID .. " AND `key` = " .. key .. ";")
        if result:getID() == -1 then
            print("getOfflinePlayerStorageValue - No storage value found for", name, "with key", key)
            return nil
        end
        local ret = result:getDataInt("value")
        print("getOfflinePlayerStorageValue - Retrieved storage value for", name, "with key", key, "is", ret)
        result:free()
        return ret
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return nil
    end
end

function getOfflinePlayerValue(name, value)
    local playerGUID = getPlayerGUIDByName(name)
    print("getOfflinePlayerValue - Player GUID for", name, "is", playerGUID)
    if playerGUID then
        local result = db.getResult("SELECT `" .. value .. "` FROM `players` WHERE `id` = " .. playerGUID .. ";")
        if result:getID() == -1 then
            print("getOfflinePlayerValue - No value found for", name, "with field", value)
            return nil
        end
        local ret = result:getDataInt(value)
        print("getOfflinePlayerValue - Retrieved value for", name, "with field", value, "is", ret)
        result:free()
        return ret
    else
        print("Error: Player GUID for " .. name .. " is nil.")
        return nil
    end
end


ai pega market sale

 

Link para o comentário
Compartilhar em outros sites

  • 0
Connect casually with like-minded individuals on the ultimate dating platform.
Authentic Damsels
[URL=https://datesnow.life]Superlative casual Dating[/URL]
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...