Search the Community

Showing results for tags 'vector3'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
  • Archive
  • Private Bugtracker

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Gang


Location


Occupation


Interests

Found 1 result

  1. Olá pessoas deliciosamente bonitas! Bom, estou desenvolvendo um save-system por SQLite, porém, na parte de salvar as coordenadas do jogador, do contrário de salvar cada um dos tipos de coordenadas em uma coluna (X - Y - Z) eu queria salvar em uma única coluna (Coordenadas), mas como vocês devem saber, dados obtidos de um db são retornados como string, então utilizei Vector3 e tonumber, mas com o tonumber retorna um valor nulo, e sem ele retorna uma string, como eu poderia fazer para retornar o valor original de coordenadas? Código: local x2, y2, z2 = 675.99396,-1692.27075,8.70498 -- LUGAR QUE VAI SPAWNAR QUANDO CRIAR CONTA NOVA local db = exports.ds_sqlite db:exec("CREATE TABLE IF NOT EXISTS Usuarios (Nick TEXT, Usuario TEXT, Serial TEXT, Skin INT, Dinheiro INT, Coordenadas TEXT, Interior INT, Dimensao INT, Procurado INT)") function loadUsuarios(player, acc) local accName = getAccountName(getPlayerAccount(player)) local datas = db:query("SELECT * FROM Usuarios WHERE Usuario=? LIMIT 1", accName) if (datas and type(datas) == "table" and #datas > 0) then -- @Datas setElementData(player, "CRP:Skin", tonumber(datas[1]["Skin"])) setElementData(player, "CRP:Dinheiro", tonumber(datas[1]["Dinheiro"])) setElementData(player, "CRP:Coordenadas", datas[1]["Coordenadas"]) setElementData(player, "CRP:Interior", tonumber(datas[1]["Interior"])) setElementData(player, "CRP:Dimensao", tonumber(datas[1]["Dimensao"])) setElementData(player, "CRP:Procurado", tonumber(datas[1]["Procurado"])) iprint(datas[1]["Coordenadas"]) -- @Funções setCameraTarget(player, player) fadeCamera(player, true, 2.0) spawnPlayer(player, Vector3(datas[1]["Coordenadas"])) setElementPosition(player, Vector3(datas[1]["Coordenadas"])) setElementModel(player, tonumber(datas[1]["Skin"])) setPlayerMoney(player, tonumber(datas[1]["Dinheiro"])) setElementInterior(player, tonumber(datas[1]["Interior"])) setElementDimension(player, tonumber(datas[1]["Dimensao"])) setPlayerWantedLevel(player, tonumber(datas[1]["Procurado"])) else setCameraTarget(player, player) fadeCamera(player, true, 2.0) spawnPlayer(player, x2, y2, z2) setElementPosition(player, x2, y2, z2) local x, y, z = getElementPosition(player) db:exec("INSERT INTO Usuarios VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), accName, getPlayerSerial(player), getElementModel(player), getPlayerMoney(player), x..","..y..","..z + 0.7, getElementInterior(player), getElementDimension(player), getPlayerWantedLevel(player)) end end function saveUsuarios(player, acc) local accName = getAccountName(getPlayerAccount(player)) local datas = db:query("SELECT * FROM Usuarios WHERE Usuario=? LIMIT 1", accName) if (#datas > 0) then local x, y, z = getElementPosition(player) db:query("UPDATE Usuarios SET Nick=?, Usuario=?, Serial=?, Skin=?, Dinheiro=?, Coordenadas=?, Interior=?, Dimensao=?, Procurado=?", getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), accName, getPlayerSerial(player), getElementModel(player), getPlayerMoney(player), x..","..y..","..z + 0.7, getElementInterior(player), getElementDimension(player), getPlayerWantedLevel(player)) end end addEventHandler("onPlayerLogin", root, function() for index, players in ipairs(getElementsByType("player")) do if (players == source) then local account = getPlayerAccount(players) loadUsuarios(players, account) end end end ) addEventHandler("onPlayerQuit", root, function() for index, players in ipairs(getElementsByType("player")) do if (players == source) then local account = getPlayerAccount(players) if (account) then saveUsuarios(players, account) end end end end )