Alright, so as most of you know, I'm not good with client side 'stuff'. So I'm going to get to the point now.
So. I did thing 'funky', and I'm pretty sure that it's not the proper way to do it at all.
So, basically, on my shared side, I have a timer every second, updating this number, and sending the data through usermessages.
Shared File (Basically all server side)
function CheckPlayerPointsXP()
timer.Create( "CheckXPOnPlayers", 1, 0, function()
local GetPlayers = player.GetAll()
for k,v in pairs(GetPlayers) do
if v:IsValid() then
local GetPoints = sql.QueryValue( "SELECT Points FROM TDM_XP_SYSTEM WHERE UniqueID = '"..v:UniqueID().."'" )
umsg.Start("TDMGETPOINTS2")
umsg.String(GetPoints)
umsg.String(k)
umsg.End()
end
end
end)
end
Then on my client side, I have it getting the usermessages, and setting PData by player.id. I just wanted ot know if there was a better way of doing it, so it uses less resources..
Client Side
function TDMGETPOINTS2(data)
local PlayerPointsByXP = data:ReadString()
local PlayerPointsByXPID = data:ReadString()
if player.GetByID(PlayerPointsByXPID):IsValid() then
player.GetByID(PlayerPointsByXPID):SetPData("MyXPPoints", PlayerPointsByXP)
end
end
usermessage.Hook("TDMGETPOINTS2", TDMGETPOINTS2)