Jump to content

Completar label con un dato de server


Seyer

Recommended Posts

Hola, quiero saber cómo hacer para que labels o funciones (getElementModel por ejemplo) se comparen con los datos en la db correctamente.

Ejemplo:

Server:

function save(thePlayer)
local u = getAccountName(getPlayerAccount(thePlayer))
local skin = getElementModel(thePlayer)	
	exports.SZSQL:_Exec("UPDATE users SET Skin=? WHERE Usuario = ?", skin, u)
end

function load(thePlayer)
local u = getAccountName(getPlayerAccount(thePlayer))
local skin = exports.SZSQL:_QuerySingle("SELECT Skin FROM users WHERE Usuario = ?",u)
  setElementModel(thePlayer, skin)
end

Grax de antemano ❤️

#Edit: me faltó decir que tmb quiero saber esto mismo pero para completar un label que diga cuánto tiene depositado ese usuario.

Tipo así:

Client: 

--Label
dl_l = guiCreateLabel(10, 41, 261, 22, "Dinero depositado: $", false, d_v)
guiSetFont(dl_l, "default-bold-small")
guiLabelSetColor(dl_l, 41, 254, 0)

--Lo que intenté
function act(check)
	guiSetText(dl_l, "Dinero depositado: $"..check)
end
addEvent("act", true)
addEventHandler("act", getLocalPlayer(), act)

Server:

--Lo que intenté x2
function refresh(thePlayer, check)
local u = getAccountName(getPlayerAccount(thePlayer))
local check = exports.SZSQL:_QuerySingle("SELECT Depositado FROM bank WHERE Usuario = ?", u)
	triggerClientEvent(thePlayer, "act", getRootElement(), check)
end

 

Edited by Seyer
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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