Jump to content

Ayuda Data base


Plate

Recommended Posts

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 

Link to comment
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?

Link to comment

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 

Link to comment
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.

Link to comment
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 :D

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 by Guest
Link to comment

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) 

Link to comment
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

Link to comment
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.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...