Hey, i got problem with drawing the Food percentage correctly, also my HUD won't show the amount of my money, only the salary. I have DarkRP server.
MONEY PROBLEM:
local ply = LocalPlayer()
if not IsValid(ply) then return end
local muns = DarkRP.formatMoney(ply:getDarkRPVar("money") || 0)
local playername = ply:Nick()
local money = DarkRP.formatMoney(money)
draw.SimpleText(ply:Nick(),"text",135,ScrH() -1070,Color(255,255,255,220),1,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
draw.SimpleText(ply:getDarkRPVar( "job" ),"Bartext",384,ScrH() -1070,Color(255,255,255,220),1,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
draw.SimpleText(money,"text",600,ScrH() -1070,Color(255,255,255,220),1,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
draw.SimpleText("$"..ply:getDarkRPVar( "salary" ),"text",700,ScrH() -1070,Color(255,255,255,220),1,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
FOOD PROBLEM:
https://files.facepunch.com/forum/upload/251957/5f623436-93d8-497b-8d80-60db8044b3cf/Screenshot_43.png
local food = ply:getDarkRPVar("Energy") or 100
draw.RoundedBox(0,1300,ScrH() - 1080,248,20,Color(80,80,80,255))
if hp > 100 then
draw.RoundedBox(0,1300,ScrH() - 1080,248,20,Color(150,0,0,255))
else
draw.RoundedBox(0,1300,ScrH() - 1080,food * 2.48,20,Color(0,100,0,255))
end
draw.SimpleText(food.. "%", "Bartext",1520,ScrH() -1070,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
draw.SimpleText("Hunger","text",1350,ScrH() -1070,Color(255,255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
For DarkRP money use:
Local money = LocalPlayer():getDarkRPVar("money")
local food = math.Round(ply:getDarkRPVar("Energy")) or 100
local muns = DarkRP.formatMoney(ply:getDarkRPVar("money") || 0)
local money = DarkRP.formatMoney(money)
-- just look at these two lines from your code. I'll let you figure it out.
I tested them both. Won't work still.
dude...
local food = math.Round(ply:getDarkRPVar("Energy")) or 100
Yes i did read it, but i can't solve it,
this should work, yet it doesn't i can't find the problem that is why i am asking help.
P.S The local food line doens't work. Same result with it.
local muns = DarkRP.formatMoney(ply:getDarkRPVar("money") || 0)
why do you even use DarkRP.formatMoney???
Just do
local Player = LocalPlayer()
local muns = Player:getDarkRPVar("money")
because it formats the number into a string like this: $102,423,111
It's still not working, feels like the problem ain't in that part.
local money = DarkRP.formatMoney(money)
you're formatting an in-existent variable
Not only that, but then you're using that invalid variable in your drawing function instead of using the functional one, that being "muns".
https://gist.github.com/JohnsonMcBig/a65b78feb57b08fbc71f757b74c36144
Sorry, you need to Log In to post a reply to this thread.