Yeah, so I was doing some coding today when I came across a little error.
My code:
Server Side:
function EnableGod(ply, command, args, public)
if ply:IsAdmin() then
local player_1 = player.GetByID(args[1])
player_1:GodEnable()
else
ply:PrintMessage( HUD_PRINTTALK, "You Don't Have Access to this command!")
end
end
concommand.Add( "ucc2_god_enable", EnableGod)
Client Side:
button.DoClick = function ()
RunConsoleCommand("ucc2_god_enable", PlayerID)
end
The Error:
TEST [lua/autorun/server/rb655_item_pickup_fix.lua][lua/autorun/server/ucc2_sv.lua]
TEST [lua/autorun/server/rb655_map_dupe_fix.lua][lua/autorun/server/ucc2_sv.lua]
[ERROR] lua/autorun/server/ucc2_sv.lua:61: attempt to call method 'GodEnable' (a nil value)
1. unknown - lua/autorun/server/ucc2_sv.lua:61
2. unknown - lua/includes/modules/concommand.lua:69
This is a shot in the dark, but try tonumber(args[1]) … It’s possible that the arguments received are in string form, so it’d be trying to do player.GetByID(“1”) instead of the proper player.GetByID(1)
Well, it seems like that sort of fixed the issue, I have only one (kind of) unreleated issue with it, if not I will make a new post about it, Thanks for your help!