Jump to content

SQL


Sasu

Recommended Posts

Posted

Esto me marea un poco. Primera vez que uso SQL. Alguna idea como puedo distinguir el lider del gang :S.

function crearGang(thePlayer, gangName, liderName) 
liderText = "lider" 
crear = executeSQLQuery("INSERT INTO gangSystem(gangs, members) VALUES(?,?=?=?)", gangName, liderText, gangName, liderName) 
local account = getPlayerAccount(thePlayer) 
setAccountData(account, "Gang", gangName) 
setElementData(thePlayer, "Gang", gangName) 
if crear then 
outputDebugString("Se ha creado un gang con nombre: "..gangName.." el cual el lider es "..liderName) 
end 
end 
addEvent("onCreateGang", true) 
addEventHandler("onCreateGang", resourceRoot, crearGang) 
  

State: Inactive

Posted

La verdad que ese script no tiene mucho sentido, digo por la query de SQL.

Yo usaria dos tablas, una para las gangs y otra para los miembros.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
La verdad que ese script no tiene mucho sentido, digo por la query de SQL.

Yo usaria dos tablas, una para las gangs y otra para los miembros.

Si solid. Eso estaba pensando hoy cuando estaba caminando a mi casa. Igual gracias. Luego posteare x si nesecito ayuda.

State: Inactive

Posted

Por que no agrega un row ?

server:

function obtenermiembros(playerName, info) 
if (not getElementData(source, "Gang") == "None") then 
local gangName = getElementData(source, "Gang") 
playerName = executeSQLQuery("SELECT Nombre FROM members WHERE gangName=?", gangName  ) 
triggerClientEvent("gangMiembros", source, playerName) 
end 
end 
addEventHandler("onPlayerLogin", root, obtenermiembros) 

client:

function miembros(playerName, info) 
for _, nombres in ipairs(playerName) do 
local row = guiGridListAddRow ( playerGangList ) 
guiGridListSetItemText ( playerGangList, row, nameColumn, playerName, false, false ) 
end 
end 
addEvent("gangMiembros", true) 
addEventHandler("gangMiembros", root, miembros) 

State: Inactive

Posted

-- client side:

function miembros ( playerName ) 
    for _, nombres in ipairs ( playerName ) do 
        local row = guiGridListAddRow ( playerGangList ) 
        guiGridListSetItemText ( playerGangList, row, nameColumn, nombres.Nombre, false, false ) 
    end 
end 
addEvent ( "gangMiembros", true ) 
addEventHandler ( "gangMiembros", root, miembros ) 

-- server side:

function obtenermiembros ( ) 
    if ( getElementData ( source, "Gang" ) ~= "None" ) then 
        local gangName = getElementData ( source, "Gang" ) 
        local playerName = executeSQLQuery ( "SELECT Nombre FROM members WHERE gangName = ?", gangName ) 
        triggerClientEvent ( source, "gangMiembros", source, playerName ) 
    end 
end 
addEventHandler ( "onPlayerLogin", root, obtenermiembros ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

De nada.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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