1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

SOLVED/CLOSED

Discussion in 'DarkRP Modding Questions & Help' started by H3X G4MING, Aug 8, 2017.

  1. H3X G4MING

    H3X G4MING New Member

    On my server, I have created a new gamemode by the name of starwarsrp (btw, please check my previous thread as I need urgent help with it), and I have came across an error. If anyone could help, that would be appreciated!

    Code (Text):
    [ERROR] gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:23: attempt to index local 'jobTable' (a nil value)
      1. Call - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:23
       2. unknown - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:62
     
     
  2. System

    System Active Member

    I have created a new gamemode by the name of starwarsrp
     
  3. FireWolf

    FireWolf New Member

    It would be nice to see the code so I can actually see what's wrong rather than guessing.
     
  4. H3X G4MING

    H3X G4MING New Member

    Oh sorry, here you go:

    Code (Text):
    local GUIToggled = false
    local mouseX, mouseY = ScrW() / 2, ScrH() / 2
    function GM:ShowSpare1()
        local jobTable = LocalPlayer():getJobTable()

        if jobTable.ShowSpare1 then
            return jobTable.ShowSpare1(LocalPlayer())
        end

        GUIToggled = not GUIToggled

        if GUIToggled then
            gui.SetMousePos(mouseX, mouseY)
        else
            mouseX, mouseY = gui.MousePos()
        end
        gui.EnableScreenClicker(GUIToggled)
    end

    function GM:ShowSpare2()
        local jobTable = LocalPlayer():getJobTable()

        if jobTable.ShowSpare2 then
            return jobTable.ShowSpare2(LocalPlayer())
        end

        DarkRP.toggleF4Menu()
    end

    function GM:PlayerStartVoice(ply)
        if ply == LocalPlayer() then
            ply.DRPIsTalking = true
            return -- Not the original rectangle for yourself! ugh!
        end
        self.Sandbox.PlayerStartVoice(self, ply)
    end

    function GM:PlayerEndVoice(ply)
        if ply == LocalPlayer() then
            ply.DRPIsTalking = false
            return
        end

        self.Sandbox.PlayerEndVoice(self, ply)
    end

    function GM:OnPlayerChat()
    end

    local FKeyBinds = {
        ["gm_showhelp"] = "ShowHelp",
        ["gm_showteam"] = "ShowTeam",
        ["gm_showspare1"] = "ShowSpare1",
        ["gm_showspare2"] = "ShowSpare2"
    }

    function GM:PlayerBindPress(ply, bind, pressed)
        self.Sandbox.PlayerBindPress(self, ply, bind, pressed)

        local bnd = string.match(string.lower(bind), "gm_[a-z]+[12]?")
        if bnd and FKeyBinds[bnd] then
            hook.Call(FKeyBinds[bnd], GAMEMODE)
        end

        if not self.Config.deadvoice and not ply:Alive() and string.find(string.lower(bind), "voicerecord") then return true end
    end

    function GM:InitPostEntity()
        hook.Call("teamChanged", GAMEMODE, GAMEMODE.DefaultTeam, GAMEMODE.DefaultTeam)
    end

    function GM:teamChanged(before, after)
    end

    local function OnChangedTeam(um)
        local oldTeam, newTeam = um:ReadShort(), um:ReadShort()
        hook.Call("teamChanged", GAMEMODE, oldTeam, newTeam) -- backwards compatibility
        hook.Call("OnPlayerChangedTeam", GAMEMODE, LocalPlayer(), oldTeam, newTeam)
    end
    usermessage.Hook("OnChangedTeam", OnChangedTeam)

    timer.Simple(0, function() GAMEMODE.ShowTeam = DarkRP.openKeysMenu end)
     
    PS:Have not edited this at all, nor have I edited darkrp's core files
    --- Double Post Merged, Aug 8, 2017 ---
    Oh, and, I don't literally mean I created it, just meant I created the gamemode folder XD
     
  5. Sir Klutch

    Sir Klutch Active Member

    An earlier error is occurring before jobTable even loads. Check for earlier errors.
     

Share This Page