Jump to content

OrbTanT

Members
  • Posts

    226
  • Joined

  • Last visited

Everything posted by OrbTanT

  1. I am trying to save the data of the account, when the player leaves the server, but this one presenting the following error, I have already tried several ways, but nothing solved. WARNING: GWlogin\server.lua:171: dbExec failed; (1) near "WHERE": syntax error function savePlayerData(player) local account = getPlayerName(player) local x, y, z = getElementPosition(player) local money = getPlayerMoney(player) local health = getElementHealth(player) local armor = getPedArmor(player) local skin = getElementModel(player) local int = getElementInterior(player) local dim = getElementDimension(player) local weapons = { } local kills = tonumber(getElementData(player, "Kills")) or 0 local deaths = tonumber(getElementData(player, "Deaths")) or 0 local weaponstats = toJSON(weaponstats_) for i=1, 12 do weapons[i] = { getPedWeapon(player, i), getPedTotalAmmo(player, i)} end local weapons = toJSON(weapons) outputDebugString ( "GWsql: Tentando salvar a conta (Player: "..account..") userdata." ) return dbExec(db, "UPDATE accounts SET Money=?, Armour=?, Health=?, x=?, y=?, z=?, Skin=?, Interior=?, Dimension=?, Weapons=?, Kills=?, Deaths=?, weapstats=?, WHERE user = '" .. account .. "' ", money, armor, health, x, y, z, skin, int, dim, weapons, kills, deaths, weaponstats ) end
  2. script está funcionando muito bem, obrigado a todos pela ajuda.
  3. Personal is happening next mistake, I do not understand what is wrong. WARNING: gangsystem\server.lua:2: dbExec failed; (1) AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY dbExec(db, "CREATE TABLE IF NOT EXISTS gangs (gang_cod INT PRIMARY KEY AUTOINCREMENT, name TEXT, owner TEXT, color TEXT)")
  4. Thanks for the tips, I'll study more.
  5. It returned right in the outputDebugString, I should be using sqlite in the wrong way, I can not get the level that is stored there, as Leader or Member function getPlayerGangLevel ( player, commandName ) local myLevel = dbExec(db, "SELECT level FROM ganguemembers WHERE account = '" ..getPlayerName(player).. "' " ); if (myLevel) then return outputDebugString("meu level") else return outputDebugString("falha em puxar o level do jogador") end end addCommandHandler("getlevel", getPlayerGangLevel)
  6. So the code is working well? Just change the part of select? Nothing works, does not pull the ganguemembers table player level. function getPlayerGangLevel ( player ) local myLevel = dbExec(db, "SELECT level FROM ganguemembers WHERE account = '" ..getPlayerName(player).. "' " ); return myLevel[1]["level"] end function testePlayerLevel(player, commandName) mylevel = getPlayerGangLevel(player) outputChatBox("Meu level é: "..myLevel, player, 255, 255, 0, false) end addCommandHandler("getlevel", testePlayerLevel)
  7. Can you tell me which way to get information from the table, I'm trying to pull the player's level, but is giving error ERROR: gangsystem\server.lua:34: attempt to index local 'select' (a boolean value) function getPlayerGangLevel ( player ) local select = dbExec(db, "SELECT level FROM ganguemembers WHERE account = '" ..getPlayerName(player).. "' " ); return select["level"] end function testePlayerLevel(player, commandName) mylevel = getPlayerGangLevel(player) outputChatBox("Meu level é: "..myLevel, player, 255, 255, 0, false) end addCommandHandler("getlevel", testePlayerLevel)
  8. Ours, I searched and looked for the error and had not noticed, thank you
  9. Good start with a gang system using sqlite to save the data, a part of creating a gang is working even more with future updates, I'm new using SQLite and I'm not able to do anything I like how to pull the player's level in the function GetPlayerGangLevel, I'm not sure how to check a table. You are experiencing the following error: ERROR: gangsystem\server.lua:33: attempt to call upvalue 'db' (a userdata value) local db = dbConnect("sqlite", "/testegang.db") dbExec(db, "CREATE TABLE IF NOT EXISTS gangues (name TEXT, leader TEXT, gangcolor TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS ganguemembers (account TEXT, gangName TEXT, level TEXT)") addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports.scoreboard:scoreboardAddColumn ( "Gang Level", getRootElement ( ), 90, "Gang Level", 12 ) for i, v in pairs ( getElementsByType ( "player" ) ) do local gangTeam = getElementData ( v, "Gang" ) if ( not gangTeam ) then setElementData ( v, "Gang", nil ) setElementData ( v, "Gang Level", nil) end if ( not getElementData ( v, "Gang Level" ) ) then setElementData ( v, "Gang Level", nil ) end end end ) local maxStr = 20 function gangIsLeader ( player, team ) local select = dbExec(db "SELECT leader FROM gangues WHERE name = '" ..team.. "' " ); if ( select[1]["leader"] == player ) then return true; else return false; end end function getPlayerGangLevel ( player ) local select = dbExec(db "SELECT account FROM ganguemembers WHERE account = '" ..player.. "' " ); if ( select[1]["account"] == player ) then return select["level"] else return false; end end function testePlayerLevel(player, commandName) mylevel = getPlayerGangLevel(player) outputChatBox("Meu level é: "..myLevel, player, 255, 255, 0, false) end addCommandHandler("getlevel", testePlayerLevel) function setPlayerGang ( player, team, level ) dbExec(db, "INSERT INTO ganguemembers VALUES (?, ?, ?)", getPlayerName(player), tostring(team), tostring(level)) setPlayerTeam(player, getTeamFromName(team)) setElementData(player, "Gang", getTeamFromName(team)) outputDebugString(getPlayerName(player).." entrou na gang "..team.." como: "..level) end function createGang(name, owner) local color = {math.random(255), math.random(255), math.random(255)} r, g, b = unpack(color) createTeam(name, r, g, b) dbExec(db, "INSERT INTO gangues VALUES (?, ?, ?)", name, getPlayerName(owner), toJSON(color)) outputDebugString(getPlayerName(owner).." criou a gang: "..name) end function criarGang ( source, commandName, teamName ) local getMoney = getPlayerMoney ( source ) if ( teamName ) then if ( getMoney < 400000 ) then outputChatBox ( "#F4A460[GANG]#F08080 Você não tem dinheiro suficiente para criar uma gang Valor 400000$", source, 255, 255, 255, true ) elseif ( string.len ( teamName ) > maxStr ) then outputChatBox ( "#1e90ff[GANG] #ffffff- O Nome da Gang nao pode ter mais de " .. maxStr .. " caracteres!", uPed, 255, 255, 255, true ); else createGang ( teamName, source ) takePlayerMoney ( source, 400000 ) setPlayerGang ( source, teamName, "Lider" ) setElementData(source, "Gang Level", "Lider") end else outputChatBox ( "#F4A460[GANG]#F08080 Uso correto: /fundargang [nome]", source, 255, 255, 255, true ) end end addCommandHandler ( "gangcriar", criarGang )
  10. bom pessoal estou fazendo um systema de gang usando sqlite para salvar os dados, a parte de criar a gang está funcionando mais ainda vou fazer atualizações futuras, sou novo usando SQLite e nao estou consigo fazer algumas funções que eu gostaria como puxar o Level do jogador na função getPlayerGangLevel, nao estou sabendo verificar a tabela. está apresentando o seguinte erro: ERROR: gangsystem\server.lua:33: attempt to call upvalue 'db' (a userdata value) local db = dbConnect("sqlite", "/testegang.db") dbExec(db, "CREATE TABLE IF NOT EXISTS gangues (name TEXT, leader TEXT, gangcolor TEXT)") dbExec(db, "CREATE TABLE IF NOT EXISTS ganguemembers (account TEXT, gangName TEXT, level TEXT)") addEventHandler ( "onResourceStart", resourceRoot, function ( ) exports.scoreboard:scoreboardAddColumn ( "Gang Level", getRootElement ( ), 90, "Gang Level", 12 ) for i, v in pairs ( getElementsByType ( "player" ) ) do local gangTeam = getElementData ( v, "Gang" ) if ( not gangTeam ) then setElementData ( v, "Gang", nil ) setElementData ( v, "Gang Level", nil) end if ( not getElementData ( v, "Gang Level" ) ) then setElementData ( v, "Gang Level", nil ) end end end ) local maxStr = 20 function gangIsLeader ( player, team ) local select = dbExec(db "SELECT leader FROM gangues WHERE name = '" ..team.. "' " ); if ( select[1]["leader"] == player ) then return true; else return false; end end function getPlayerGangLevel ( player ) local select = dbExec(db "SELECT account FROM ganguemembers WHERE account = '" ..player.. "' " ); if ( select[1]["account"] == player ) then return select["level"] else return false; end end function testePlayerLevel(player, commandName) mylevel = getPlayerGangLevel(player) outputChatBox("Meu level é: "..myLevel, player, 255, 255, 0, false) end addCommandHandler("getlevel", testePlayerLevel) function setPlayerGang ( player, team, level ) dbExec(db, "INSERT INTO ganguemembers VALUES (?, ?, ?)", getPlayerName(player), tostring(team), tostring(level)) setPlayerTeam(player, getTeamFromName(team)) setElementData(player, "Gang", getTeamFromName(team)) outputDebugString(getPlayerName(player).." entrou na gang "..team.." como: "..level) end function createGang(name, owner) local color = {math.random(255), math.random(255), math.random(255)} r, g, b = unpack(color) createTeam(name, r, g, b) dbExec(db, "INSERT INTO gangues VALUES (?, ?, ?)", name, getPlayerName(owner), toJSON(color)) outputDebugString(getPlayerName(owner).." criou a gang: "..name) end function criarGang ( source, commandName, teamName ) local getMoney = getPlayerMoney ( source ) if ( teamName ) then if ( getMoney < 400000 ) then outputChatBox ( "#F4A460[GANG]#F08080 Você não tem dinheiro suficiente para criar uma gang Valor 400000$", source, 255, 255, 255, true ) elseif ( string.len ( teamName ) > maxStr ) then outputChatBox ( "#1e90ff[GANG] #ffffff- O Nome da Gang nao pode ter mais de " .. maxStr .. " caracteres!", uPed, 255, 255, 255, true ); else createGang ( teamName, source ) takePlayerMoney ( source, 400000 ) setPlayerGang ( source, teamName, "Lider" ) setElementData(source, "Gang Level", "Lider") end else outputChatBox ( "#F4A460[GANG]#F08080 Uso correto: /fundargang [nome]", source, 255, 255, 255, true ) end end addCommandHandler ( "gangcriar", criarGang )
  11. Good, even disabling the firewall, the doors are still closed, firewall antivirus also disabled, good don't know if it helps more when I turn on mta server, my server appears as local in the browser of the mta.
  12. Hello, I am trying to open my server, in a beta version on my computer, before buying a host, more I can't open the doors 22126, 22003, 22005, already released in virtual server and port triggering on my router, and the windows firewall, even so they are still closed, my router is a D-Link DIR 610 Version B1, I thought that the problem was the router, more trying to open with my old router, was closed, which could be the problem?
  13. Now work thank you. One more thing, how can I put a line on the radar indicating the limit?
  14. Must be within the < /map>? More while the not necessary?
  15. Hello, I am trying to use the resource maplimit in dm map that I am creating, more is not creating the limit, without errors in debug, not only creates the limit, what am I doing wrong? "1998" y="-1450" /> "1998" y="-1440" /> "2008" y="-1440" /> "2008" y="-1450" />
  16. mais se eu deixar assim como no server side vou poder verificar se o dxRectangle está 250 de tamanho?
  17. obrigado =), mesmo com timer e triggerServerEvent, não vai funcionar muito bem. teria que funcionar da seguinte forma, quando está aqui no server, quando fica >= 250 então domina, e pelo server msm add +1 no seg. mais não funciona. client: function dominar_start ( ) addEventHandler ( "onClientRender", root, dominar_render ) end addEvent ( "dominar_start", true ) addEventHandler ( "dominar_start", root, dominar_start ) function dominar_stop ( ) removeEventHandler ( "onClientRender", root, dominar_render ) end addEvent ( "dominar_stop", true ) addEventHandler ( "dominar_stop", root, dominar_stop ) function dominar_render () local seg = 0 dxDrawRectangle(55, 478, seg, 20, tocolor(255, 100, 0, 255), false) dxDrawLine(54, 478, 304, 478, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(304, 478, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 498, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 478, 54, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawText("atacando territorio!", 53, 478, 304, 498, tocolor(255, 255, 255, 255), 0.65, "bankgothic", "center", "center", false, false, false, false, false) end server: turf[id] = { } turf[id].col = col turf[id].area = radar turf[id].owner = owner or "server" turf[id].attackers = nil turf[id].seg = 0 setElementData ( turf[id].col, "turfId", id ) setElementData ( turf[id].col, "TurffingTable", turf[id] ) addEventHandler ( "onColShapeHit", turf[id].col, onColShapeHit ) addEventHandler ( "onColShapeLeave", turf[id].col, onColShapeLeave ) return turf[id] setTimer( function ( ) for id, data in pairs ( turf ) do if ( data.attackers ) then local players = { attackers = { }, owners = { } } local isGangInTurf = false local isOwnerInTurf = false for i, v in pairs ( getElementsWithinColShape ( data.col, "player") ) do local g = getPlayerTeam ( v ) if ( g == data.attackers ) then isGangInTurf = true table.insert ( players.attackers, v) elseif ( g == data.owner ) then isOwnerInTurf = true table.insert( players.owners, v ) end end local x, y, z = getElementPosition( data.col ) if ( isGangInTurf ) then if ( turf[id].owner == "server" ) then turf[id].seg = turf[id].seg + 1 if ( turf[id].seg >= 250 ) then outputChatBox( "A gang "..getTeamName(turf[id].attackers).." dominou o territorio "..getZoneName( x, y, z).."!.", root, 0, 255, 0) setTurfOwner( id, turf[id].attackers ) end end end for i, v in pairs ( players ) do for k, p in pairs ( v ) do end end end end end, 1000, 0)
  18. é que eu preciso de alguma forma verificar se o o dxRectangle tem um tamanho igual a 250, e se chegar a 250, killTimer e domina o territorio. o evento de dominar vai estar do lado do server.
  19. como posso fazer esse dxDrawRectangle funcionar com um timer no server side, por exemplo a cada 1s ele aumenta + 1 no tamanho do rectangle. tentei fazer da seguinte forma. mais nada acontence. teria que fazer um triggerClientEvent pra funcionar? client: addEventHandler("onClientRender", root, function() dxDrawRectangle(55, 478, atack, 20, tocolor(255, 100, 0, 255), false) dxDrawLine(54, 478, 304, 478, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(304, 478, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 498, 304, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(54, 478, 54, 498, tocolor(255, 255, 255, 255), 1, false) dxDrawText("atacando territorio!", 53, 478, 304, 498, tocolor(255, 255, 255, 255), 0.65, "bankgothic", "center", "center", false, false, false, false, false) end ) server: processChecks = function() atack = atack + 1 end function startChecks() if(not isTimer(checkTimer)) then checkTimer = setTimer( processChecks, 1000, 0) end end
  20. OrbTanT

    resolved.

    Nothing happens, even errors.
  21. OrbTanT

    resolved.

    It is free to use and edit. viewtopic.php?f=108&t=82870&p=761584&hilit=nerd+gaming#p761584
×
×
  • Create New...