Help with HasGunLicense [DarkRP]

I have an error with HasGunLicense.
What’s the problem,
I’m just a beginner in programming in Lua.

Example


if LocalPlayer():getDarkRPVar("HasGunLicense") then
draw.SimpleText("text",TargetID,0,0,Color(255,255,255,255),0, 2)
end

Error


[ERROR] addons/darkrpmodification/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:118: attempt to concatenate a nil value
  1. v - addons/darkrpmodification/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:118
   2. unknown - lua/includes/modules/hook.lua:84



According to the error that part of code you gave us has nothing to do with it.
Also please, put code inside


 tags like so:



– HELLO




[editline]18th January 2017[/editline]

What is line 118 of cl_hudreplacement?

draw.SimpleText("Job: "..LocalPlayer():getDarkRPVar("job"),TargetID,ScrH() * 0.01, ScrW() * 0.590,Color(255,255,255,255),0, 2)

Do "Job: "…(LocalPlayer():getDarkRPVar(“job”) or “Undefined”) as the first arg instead

Like that?


draw.SimpleText("Job: "..LocalPlayer():getDarkRPVar("job") or "Undefined"),TargetID,ScrH() * 0.01, ScrW() * 0.300,Color(255,255,255,255),0, 2)

You’re missing the open parenthesis before the LocalPlayer call.

You can give the corrected code?

Reread my first post – I already did.

Thanks to you code_gs, i already solved it


local hasLicense = LocalPlayer():getDarkRPVar( "HasGunlicense" )
if ( hasLicense ) then 
draw.SimpleText("text",TargetID,scrh * 0.18, scrw * 0.283 * 2,white)
 end