Jump to content

Wyll_

Members
  • Posts

    3
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Wyll_'s Achievements

Vic

Vic (3/54)

0

Reputation

  1. Bom Minha duvida é a seguinte estou tentando obter os dados salvo da data-base, que eu fiz para treinar mas a questão e que no final só consigo retornar table não o valor dentro dela local db = dbConnect("sqlite","db/savesystem.db") function loaddb() dbExec(db,"CREATE TABLE IF NOT EXISTS SaveSystem(Account TEXT, Serial TEXT, Money REAL, POS TEXT, Skin TEXT )") print("DATA BASE CRIADA") end addEventHandler("onResourceStart",getRootElement(getThisResource()),loaddb) addEventHandler("onPlayerQuit",root,function() local result = dbPoll(dbQuery(db,"SELECT * FROM SaveSystem WHERE Account = ?",getAccountName(getPlayerAccount(source))),-1) if #result < 1 then local posx, posy,posz = getElementPosition(source) local skin = getElementModel(source) local serial = getPlayerSerial(source) local money = getPlayerMoney(source) local acc = getAccountName(getPlayerAccount(source)) local pos = {posx,posy,posz} dbExec(db,"INSERT INTO SaveSystem(Account,Serial,Money,POS,Skin) VALUES(?,?,?,?,?)",acc,serial,money,toJSON(pos),skin) print("DATA BASE INSERIU") else local posx, posy,posz = getElementPosition(source) local skin = getElementModel(source) local serial = getPlayerSerial(source) local money = getPlayerMoney(source) local acc = getAccountName(getPlayerAccount(source)) local pos = {posx,posy,posz} dbExec(db,"UPDATE SaveSystem SET Account=?,Serial=?,Money=?,POS=?,Skin=?",acc,serial,money,toJSON(pos),skin) print("DATA ATUALIZOU") end end) addEventHandler("onPlayerLogin",root,function() local result = dbPoll(dbQuery(db,"SELECT * FROM SaveSystem WHERE Account = ?",getAccountName(getPlayerAccount(source))),-1) if #result > 0 then setPlayerMoney(source,result[3]["SaveSystem"] ) --setPlayerMoney(source,dbPoll(dbQuery(db,"SELECT * FROM SaveSystem WHERE Money = ?",-1))) tentei dessa forma mas retorna table tb else return print("N tem info") end end)
  2. Oi não sou experiente em scriptar mas como vejo que a seção portuguesa de ajuda no fórum não estão respondendo, posso tentar te ajudar pra corrigir esse bug fiz a seguinte verificar se o elemento que estava colidindo com o marker era um Player da tb para verificar se ele esta em um veiculo ou nao aqui esta o seu codigo, "tive que mudar as cordenas de deixar o marker visivel pra saber oque estava fazendo" tb deixei um tp pra ir no local mais rapido lembre-se de tirar depois local gate = createObject(10575, 1588.30005, -1638.36121, 13.38356, 0, 0, 270.7470703125) local marker = createMarker(1588.30005, -1638.36121, 13.38356, "cylinder", 8, 255, 0, 0, 255) function moveGate(thePlayer) if getElementType(thePlayer) == "player" then ----Verifica Se o Elemento Que esta Colidindo é um "player" nao um veiculo if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Detran")) then moveObject(gate, 3000, 1588.30005, -1638.36121, 0.38356) end end end addEventHandler("onMarkerHit", marker, moveGate) function move_back_gate() moveObject(gate, 3000, 1588.30005, -1638.36121, 13.38356) end addEventHandler("onMarkerLeave", marker, move_back_gate) ----------------------teleporte para o local da porta Lembre-se de Retirar dps function tpplayer(player) if getElementType(player) == "player" then setElementPosition(player,1587.94531, -1627.05432, 12.79214,true) end end addCommandHandler("tp",tpplayer,false,true)
  3. playerzone = {} function table.toString(tbl, beautify, recLvl) if beautify == nil then beautify = true end recLvl = recLvl or 0 local str = '{'..(beautify and '\n' or '') local kStr local vStr for k,v in pairs(tbl) do for i=0,recLvl do str = str..(beautify and '\t' or '') end kStr = (type(k) == 'string' and '"%s"' or '%s') kStr = ('['..kStr..']'):format(k) vStr = (type(v) == 'table' and table.toString(v, beautify, recLvl+1) or v) str = str..kStr..' = '..vStr str = str..(next(tbl,k) and ',' or '') str = str..(beautify and '\n' or '') end if beautify then for i=1,recLvl do str = str..'\t' end end return str..'}' end -------------------------------------------MARKRS PARA ENTRAR NA AGENCIA local function criarmarks() for a,b in ipairs(markerentrarinterioragencia["markers"]) do local markerTpInt = createMarker(b[1],b[2],b[3],markerentrarinterioragencia["Tipo-Markes"][1],markerentrarinterioragencia["Tamanho-Markes"][1],markerentrarinterioragencia["Cores-Markes"][1],markerentrarinterioragencia["Cores-Markes"][2],markerentrarinterioragencia["Cores-Markes"][3],markerentrarinterioragencia["Cores-Markes"][4]) local blipTpInt = createBlipAttachedTo(markerTpInt,42,2,255,255,255,255,-1,9999999999) addEventHandler("onMarkerHit",markerTpInt,entrarIntAgencia) end end addEventHandler("onResourceStart",getRootElement(getThisResource()),criarmarks) --------------------------------------------------------------------------------------- function entrarIntAgencia(player) if getElementType(player) == "player" and isPedInVehicle(player) then for a,b in ipairs(markerentrarinterioragencia["textos"]) do outputChatBox(markerentrarinterioragencia["textos"][1][1],player,255,255,255,true) break end else x, y, z = getElementPosition(player) city = getZoneName(x, y, z, true)-------------------------- AO ENTRAR NA AGENCIA PEGA A CIDADE DO JOGADOR table.insert(playerzone,{city}) -----------INSERE A CIDADE DA TABELA print(tostring(city))-------------PRINTA A INFORMAÇAO PARA VERIFICAR setTimer(function(player) if getElementType(player) == "player" then setElementInterior(player,10,241.71826, 111.70108, 1003.21875) end end,1000,1,player) end end local markertpMundo = createMarker(246.27213, 107.30126, 1003.21875+0.5,"arrow",1,255,0,0,255) setElementInterior(markertpMundo,10,246.27213, 107.30126, 1003.21875) function sairage(player) if getElementType(player) == "player" and isPedInVehicle(player) then for a,b in ipairs(markerentrarinterioragencia["textos"]) do outputChatBox(markerentrarinterioragencia["textos"][1][1],player,255,255,255,true) break end else if playerzone == "Los Santos" then----------------------AQUI ERA PRA MIM PEGAR A INFO DA TABELA E VERIFICAR SE É A MESMA E DAR TP NO LOCAL setElementInterior(player,0,1144.04639, -1754.88684, 13.62022) end end end addEventHandler("onMarkerHit",markertpMundo,sairage) Olá, meu primeiro post aqui, venho aprendendo lua, só que estou com um conflito de não saber para onde prosseguir, estou tentando pegar a cidade de onde o jogador esta quando hita no marker e salvo ela dentro de uma tabela, só que não estou sabendo retirar a informação da tabela e verificar se é a mesma para dar teleporte para o local determinado quando sai da agencia alguem consegue me ajudar? para eu aprender fico muito grato
×
×
  • Create New...