Plate Posted May 16, 2013 Posted May 16, 2013 Hola tengo una duda se pueden cargar posiciones desde una data base? Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Sasu Posted May 16, 2013 Posted May 16, 2013 Podes cargar todo lo que tu quieras con una base de datos, hasta lo que yo conosco. Creas tres columnas y los guardas ahi. Si hay otra manera, que alguien me corrija. State: Inactive
Plate Posted May 16, 2013 Author Posted May 16, 2013 pero las que tengo son 4 columnas en la 1 va le nombre del clan en la 2da x 3ro y 4ta z se puede cargar eso? Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Lucario Posted May 17, 2013 Posted May 17, 2013 A que tipo de columnas te refieres? gridlist de un panel?
Plate Posted May 17, 2013 Author Posted May 17, 2013 A que tipo de columnas te refieres? gridlist de un panel? Data base Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Lucario Posted May 17, 2013 Posted May 17, 2013 A eso aun no llegue yo , si posteas el codigo yo lo puedo arreglar
Plate Posted May 17, 2013 Author Posted May 17, 2013 A eso aun no llegue yo , si posteas el codigo yo lo puedo arreglar Creo que si no sabes de data base no podes arreglar un code de data base PD: El problema no es el code sino que nose como hacer para cargar 4 posiciones Code: function getClanSpawn( ClanName ) if ( not connection2 ) then return end local query = dbQuery( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ), tostring(spawnX), tostring(spawnY), tostring(spawnZ) ) -- esto nose si esta bien local result, numrows, errmsg = dbPoll ( query, -1 ) if ( type( result ) == "table" and #result == 0 or not result ) then return false else return true end end Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Lucario Posted May 17, 2013 Posted May 17, 2013 A eso aun no llegue yo , si posteas el codigo yo lo puedo arreglar Creo que si no sabes de data base no podes arreglar un code de data base PD: El problema no es el code sino que nose como hacer para cargar 4 posiciones Code: function getClanSpawn( ClanName ) if ( not connection2 ) then return end local query = dbQuery( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ), tostring(spawnX), tostring(spawnY), tostring(spawnZ) ) -- esto nose si esta bien local result, numrows, errmsg = dbPoll ( query, -1 ) if ( type( result ) == "table" and #result == 0 or not result ) then return false else return true end end Ok intentare aprender cuando pueda el database, lo que quieres es tener 3 spawnx spawny y spawnz no?
Sasu Posted May 17, 2013 Posted May 17, 2013 Puedes intentar esto: function getClanSpawn( ClanName ) if ( not connection2 ) then return end local query = dbQuery( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if result == false then return false end for _, row in pairs ( result ) do local x = row["spawnX"] local y = row["spawnY"] local z = row["spawnZ"] end return x,y,z end State: Inactive
Plate Posted May 17, 2013 Author Posted May 17, 2013 Sasuke agregame a skype(si tenes): codplate14 terminamos el tema por hay EDIT:No da error pero no funciona Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 17, 2013 Posted May 17, 2013 Puedes intentar esto: function getClanSpawn( ClanName ) if ( not connection2 ) then return end local query = dbQuery( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if result == false then return false end for _, row in pairs ( result ) do local x = row["spawnX"] local y = row["spawnY"] local z = row["spawnZ"] end return x,y,z end No hace falta el for-loop. function getClanSpawn ( ClanName ) if ( not connection2 ) then return end local query = dbQuery ( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ) ) -- esto nose si esta bien local result, numrows, errmsg = dbPoll ( query, -1 ) if ( type ( result ) == "table" and #result == 0 or not result ) then return false else return result [ 1 ].spawnX, result [ 1 ].spawnY, result [ 1 ].spawnZ end end P.D: MultiKiller: No postees si no sabes. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted May 18, 2013 Author Posted May 18, 2013 (edited) Puedes intentar esto: function getClanSpawn( ClanName ) if ( not connection2 ) then return end local query = dbQuery( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ) ) local result, numrows, errmsg = dbPoll ( query, -1 ) if result == false then return false end for _, row in pairs ( result ) do local x = row["spawnX"] local y = row["spawnY"] local z = row["spawnZ"] end return x,y,z end No hace falta el for-loop. function getClanSpawn ( ClanName ) if ( not connection2 ) then return end local query = dbQuery ( connection2, "SELECT * FROM Spawns WHERE ClanName=?", tostring ( ClanName ) ) -- esto nose si esta bien local result, numrows, errmsg = dbPoll ( query, -1 ) if ( type ( result ) == "table" and #result == 0 or not result ) then return false else return result [ 1 ].spawnX, result [ 1 ].spawnY, result [ 1 ].spawnZ end end P.D: MultiKiller: No postees si no sabes. Funciona gracias sasuke y Solid EDIT:Funciona con comando pero con edit no Client: function checkClanSpawn() local row, col = guiGridListGetSelectedItem ( CSGrid ) if ( row and col and row ~= -1 and col ~= -1 ) then local ClanName = guiGridListGetItemText ( CSGrid, row, 1 ) triggerServerEvent("onAdminCheckClanSpawn", localPlayer, ClanName) end end addEventHandler("onClientGUIClick", getSpawn, checkClanSpawn, false) server: function checkClanSpawn(ClanName) local x, y, z = getClanSpawnInfo(ClanName) triggerClientEvent("onClientClanSpawn", getRootElement(), x, y ,z) end addEvent("onAdminCheckClanSpawn", true) addEventHandler("onAdminCheckClanSpawn ", getRootElement(), checkClanSpawn) client: function checked(x, y ,z) guiSetText(SpawnX, tonumber(x)) guiSetText(SpawnY, tonumber(y)) guiSetText(SpawnZ, tonumber(z)) end addEvent("onClientClanSpawn", true) addEventHandler("onClientClanSpawn", getRootElement(), checked) Edited May 18, 2013 by Guest Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 18, 2013 Posted May 18, 2013 De nada. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted May 18, 2013 Author Posted May 18, 2013 Lee mi edit porfavor PD: Ni idea por que no anda no da error Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 18, 2013 Posted May 18, 2013 Fijate que devuelve "x", "y", "z" al enviarlo al client side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted May 18, 2013 Posted May 18, 2013 Eso es porque guiSetText solo acepta string's. function checked(x, y ,z) guiSetText(SpawnX, tostring(x)) guiSetText(SpawnY, tostring(y)) guiSetText(SpawnZ, tostring(z)) end addEvent("onClientClanSpawn", true) addEventHandler("onClientClanSpawn", getRootElement(), checked) State: Inactive
Plate Posted May 18, 2013 Author Posted May 18, 2013 Eso es porque guiSetText solo acepta string's. function checked(x, y ,z) guiSetText(SpawnX, tostring(x)) guiSetText(SpawnY, tostring(y)) guiSetText(SpawnZ, tostring(z)) end addEvent("onClientClanSpawn", true) addEventHandler("onClientClanSpawn", getRootElement(), checked) No no funciona nose por que tampoco da error Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 18, 2013 Posted May 18, 2013 Hiciste lo que yo te dije? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted May 18, 2013 Author Posted May 18, 2013 Hiciste lo que yo te dije? Ah perdon no lo abia leido Bueno checkee usando outputChatBox(para saber si pasaba lo que tenia que pasar) no obtiene las posiciones nose por que Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 18, 2013 Posted May 18, 2013 function checkClanSpawn(ClanName) outputChatBOx ( ClanName ) local x, y, z = getClanSpawnInfo(ClanName) triggerClientEvent("onClientClanSpawn", getRootElement(), x, y ,z) end addEvent("onAdminCheckClanSpawn", true) addEventHandler("onAdminCheckClanSpawn ", getRootElement(), checkClanSpawn) Fijate que dice en el chat. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted May 18, 2013 Author Posted May 18, 2013 ya lo arregle finalmente gracias Solidsnake y Sasuke Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Castillo Posted May 18, 2013 Posted May 18, 2013 Cual era el problema? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Plate Posted May 18, 2013 Author Posted May 18, 2013 Creo que el primer trigger o el addEvent de serverside Visita Full GameZ DayZ Mod Server IP: mtasa://158.69.125.144:29015
Recommended Posts