Expanding on the hud and database issue.

I just wanted to expand on this:

These lines of code represent the money, and dollar sign.


 rY = bY + 10 + 25 + 26
local money = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money"))
draw.DrawText( money, "NPGUI_DATA_JOB_S", rX, rY + 1, Color(0,0,0,255), TEXT_ALIGN_LEFT )
draw.DrawText( money, "NPGUI_DATA_JOB", rX, rY, Color(255,255,255,255), TEXT_ALIGN_LEFT )

And it returns as $0

These lines just show the default hud


local salaryText, JobWalletText
local function DrawInfo()
if ( !RPExtraTeams or !RPExtraTeams[LocalPlayer( ):Team( )] or !RPExtraTeams[LocalPlayer( ):Team( )].salary ) then return end
salaryText = salaryText or DarkRP.getPhrase("salary", DarkRP.formatMoney(RPExtraTeams[LocalPlayer( ):Team( )].salary), "")

JobWalletText = JobWalletText or string.format("%s
%s",
DarkRP.getPhrase("job", localplayer:getDarkRPVar("job") or ""),
DarkRP.getPhrase("wallet", DarkRP.formatMoney(localplayer:getDarkRPVar("money")), "")
)


However it is disabled but when I do enable the default hud, it displays the amount of money I hold.

The money doesn’t lower or higher, it’s just stuck at it’s value.

This script is heavily relied on mysql and I do have it set up, however I’m not sure if it’s a database issue or an issue within the files.
Why I suspect it’s an issue within the database is because the scoreboard also holds the same problem, as I switch jobs the scoreboard does not register and stays default.

Sources for anyone that want to look through:

Sorry if I’m repetitive, it’s all a learning experience really.

Are you sure it connects? Are you sure you have the right modules? Are you sure you have remote sql set up correctly?

I use xampp and according to the server console, it does indeed work and also there are a lot of other errors if mysql isn’t set up properly but they don’t show anymore.

edit; the modules that come with the download is all I get, so there’s no way for me to really find out.

edit2; however you could be right, is there any other way to find out if remote sql isn’t set up properly?

stays at 0

update bump: After replacing this code
(original)


rY = bY + 10 + 25 + 26
local money = DarkRP.formatMoney(LocalPlayer():getDarkRPVar("money"))
draw.DrawText( money, "NPGUI_DATA_JOB_S", rX, rY + 1, Color(0,0,0,255), TEXT_ALIGN_LEFT )
draw.DrawText( money, "NPGUI_DATA_JOB", rX, rY, Color(255,255,255,255), TEXT_ALIGN_LEFT )

with


rY = bY + 10 + 25 + 26
local money = tostring((LocalPlayer():getDarkRPVar("money")))
draw.DrawText( money, "NPGUI_DATA_JOB_S", rX, rY + 1, Color(0,0,0,255), TEXT_ALIGN_LEFT )
draw.DrawText( money, "NPGUI_DATA_JOB", rX, rY, Color(255,255,255,255), TEXT_ALIGN_LEFT )


by adding tostring money returns as nil

For some odd reason “money” which is a Darkrp convar doesn’t seem to be defined, it keeps returning as nil. Here’s what happens when I replace the original code with


rY = bY + 10 + 25 + 26
local money = tostring((LocalPlayer():getDarkRPVar("money")))
draw.DrawText( (LocalPlayer():getDarkRPVar("money")) "NPGUI_DATA_JOB_S", rX, rY + 1, Color(0,0,0,255), TEXT_ALIGN_LEFT )
draw.DrawText( (LocalPlayer():getDarkRPVar("money")), "NPGUI_DATA_JOB", rX, rY, Color(255,255,255,255), TEXT_ALIGN_LEFT )


This is the error that spams my console.


Error in hook HUDPaint: lua/includes/modules/draw.lua:147: bad argument #1 to 'gmatch' (string expected, got nil)
stack traceback:
	[C]: in function 'gmatch'
	lua/includes/modules/draw.lua:147: in function 'DrawText'
	gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:635: in function 'PlayerHUD'
	gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:259: in function 'DrawHUD'
	gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:425: in function <gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:424>
	[C]: in function '•‎​‬‪•'

[ERROR] 
  1. unknown - [C]:-1

So all I get out of this is that “money” returns as nil, it holds no value but then how do I give it value?
Or I’m completely wrong and this is a different kind of error, not sure what to do here.

edit;
could this file have anything to do with money returning as nil/not responding? - https://github.com/SurelyExploding/noobonicplague/blob/master/gamemode/modules/base/sv_data.lua

edit2:
Money can now lower and higher as of right now but it still does not display the exact value on the HUD, it stays at 0.
after playing with some settings I get this error:

How do I create a table specifically for that?