Closed BezzaWasTaken closed 3 years ago
There is no way to get the WUMA prop limit directly from the client side. You will have to create some sort of mechanism to send the prop limits from the server to the client. I would use a simple Entity:SetNWInt( string key, number value ) to set a networked int on every player that joins.
Something like this should work (not tested):
local function playerInitialSpawn(ply)
timer.Simple(3, function()
local limit = ply:GetLimits() and ply:GetLimits()["props"]
if limit then
ply:SetNWInt("ActualPropLimitOrSomething", limit:Get())
else
ply:SetNWInt("ActualPropLimitOrSomething", GetConVar( "sbox_maxprops" ):GetInt())
end
end)
end
hook.Add("PlayerInitialSpawn", "SyncWUMAPropLimit", playerInitialSpawn)
Then you can use LocalPlayer():GetNWInt("ActualPropLimitOrSomething")
instead of GetConVar( "sbox_maxprops" ):GetInt()
in your HUD code.
This is way if a player has a WUMA prop limit then that proplimit is sent, otherwise it will send the default sbox_maxprops variable. Note that it is wrapped inside a timer of 3 seconds, it is crucial that this timer is there, because we need to wait for WUMA to load the player's limits.
I am still new to Lua so if this is a simple fix I apologise.
I have a HUD on my server that shows a player what there prop limit is and when they reach it at the bottom right of the screen. Below is the current code to show this: BarText = FlatHUD.GetPhrase("props") .. ": " .. Props .. " / " .. GetConVar( "sbox_maxprops" ):GetInt()
I am currently setting prop limits by ULX ranks and I was wondering if there was a way to set my HUD to show the correct prop limit instead of the variable sbox_maxprops?
Kind Regards