Jump to content
  • Global

    Global

    Chatroom Rules

    • NO SE DA SOPORTE EN CHATBOX
    • NO SPAM
    • NO FLOOD

Recommended Posts

  • Usuario
Posted

Buenas! desde hace unos dias trato de hacer un sistema de clanes. Todo me ha ido bien, sin problemas. En donde tengo problemas es en el sistema de "log".

 

este es el DebugString Dado:

WARNING: Clan-System:662: Bad argument @ guiGridListSetItemText [expected string at argument 4, got table]

Client-Side:

addEvent("setGangLog", true)
addEventHandler("setGangLog", root,
function(theGangLogTable)
guiGridListClear(LogGridList) --- Column: theLogColumn
 
for i=1, #theGangLogTable do
local row = guiGridListAddRow(LogGridList)
guiGridListSetItemText(LogGridList, row, theLogColumn, theGangLogTable[i], false, false) --- LINEA #662
end
 
end)

Server-Side:

addEvent("mostrarLog", true)
function showGangLog( theGangName )
local theGangLogTable = {}
local theLog = executeSQLQuery("SELECT Log FROM theGangLog WHERE NameGroup=?", theGangName)
-------------------------------"SELECT * FROM punishments WHERE serial=?
if (not theLog) then return end
for i=1, #theLog do
    theGangLogTable[i] = theLog[i]
end
triggerClientEvent(source, "setGangLog", source, theGangLogTable )
theGangLogTable = {}
end
addEventHandler("mostrarLog", root, showGangLog )

Alguna sugerencia de que puedes estar mal y como repararlo? :unsure:

 

- Gracias de antemano :D

  • Ex-Staff
Posted
addEvent("mostrarLog", true)
function showGangLog( theGangName )
local theGangLogTable = {}
local theLog = executeSQLQuery("SELECT Log FROM theGangLog WHERE NameGroup=?", theGangName)
if (not theLog) then return end
		for i,logs in ipairs(theLog) do
			theGangLogTable[i] = logs["Log"] -- Obtienes el indice de todos los Logs
		end
	triggerClientEvent(source, "setGangLog", source, theGangLogTable )
	theGangLogTable = {}
end
addEventHandler("mostrarLog", root, showGangLog )

Con eso debería andar.

  • Ex-Staff
Posted

te recomendaria en vez de usar executeSQLQuery, usar dbConnect, dbQuery y todas las funciones relacionadas.

 

esto debido a que executeSQLQuery espera a que se obtenga un resultado, paralizando todo el recurso, mientras dbQuery deja que se llame una función cuando se obtengan los datos, permitiendo que continue corriendo el recurso.

 

Esto para base de datos pequeñas no se nota, pero cuando aumente tu base de datos se podra notar que andaran un poco mas lentas las cosas.

 

Los ejemplos los puedes encontar en la wiki de mta:

 

https://wiki.multitheftauto.com/wiki/DbConnect

  • Usuario
Posted
addEvent("mostrarLog", true)
function showGangLog( theGangName )
local theGangLogTable = {}
local theLog = executeSQLQuery("SELECT Log FROM theGangLog WHERE NameGroup=?", theGangName)
if (not theLog) then return end
		for i,logs in ipairs(theLog) do
			theGangLogTable[i] = logs["Log"] -- Obtienes el indice de todos los Logs
		end
	triggerClientEvent(source, "setGangLog", source, theGangLogTable )
	theGangLogTable = {}
end
addEventHandler("mostrarLog", root, showGangLog )

Con eso debería andar.

 

 

¡Gracias! :D

 

te recomendaria en vez de usar executeSQLQuery, usar dbConnect, dbQuery y todas las funciones relacionadas.

 

esto debido a que executeSQLQuery espera a que se obtenga un resultado, paralizando todo el recurso, mientras dbQuery deja que se llame una función cuando se obtengan los datos, permitiendo que continue corriendo el recurso.

 

Esto para base de datos pequeñas no se nota, pero cuando aumente tu base de datos se podra notar que andaran un poco mas lentas las cosas.

 

Los ejemplos los puedes encontar en la wiki de mta:

 

https://wiki.multitheftauto.com/wiki/DbConnect

 

Si, lo se, el problema, es que este script no es hecho por mi, si no.. digamos "modificado" le estoy añadiendo estas cosas y asi voy, y ya tenia ese tipo de codigo. Por eso lo deje. Si fuera hecho por mi usara las conecciones SQL mas nuevas, ya que son mas faciles de usar :mellow:

 

¡Salu2!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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