I currently have a config file: addons/addon_name/lua/autorun/drp_config.lua
And a HUD file: addons/addon_name/lua/autorun/client/drp_hud.lua
Here is what is in my drp_hud.lua
hook.Add("HUDPaint", "Custom_LevelingHUD", function()
surface.SetDrawColor( 99, 255, 165, 255 )
surface.DrawRect( 0, 0, DRP.CONFIG.HUD.Width, 50 )
end)
Here is what is in my drp_config.lua
DRP = {}
DRP.CONFIG = {}
DRP.CONFIG.HUD = {}
DRP.CONFIG.HUD.Width = 100
The issue is that I get this error in game
[ERROR] addons/ramrp_leveling_systems/lua/autorun/client/drp_hud.lua:11: attempt to index global 'DRP' (a nil value)
1. fn - addons/ramrp_leveling_systems/lua/autorun/client/drp_hud.lua:11
2. unknown - addons/admin_ulib-master/lua/ulib/shared/hook.lua:109
Can anyone give me any ideas?
You need to do this at the top of drp_hud.lua
AddCSLuaFile("drp_config.lua")
include("drp_config.lua")
But the drp_config.lua is autorun?
NVM, fixed (That was not the fix though - I made an error in one of the tables).
Sorry, you need to Log In to post a reply to this thread.