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.

How to get list of all jobs

Discussion in 'DarkRP Modding Questions & Help' started by Your Stalker, Aug 12, 2015.

  1. Your Stalker

    Your Stalker New Member

    Hey, is there some kind of table or function that returns a list of all the jobs on the server?

    Either TEAM_whatever or the first arguement in DarkRP.createJob() would be useful, thanks!
     
  2. Your Stalker

    Your Stalker New Member

    Matryan likes this.
  3. viper542

    viper542 Active Member

    Can't you just look at your jobs.lua
     
  4. Matryan

    Matryan Well-Known Member

    Lol
     
  5. Nick78111

    Nick78111 Member

    That only returns the players current job table, if you want all of the jobs then it use this var: RPExtraTeams

    example
    Code (Text):

    for k,v in pairs(RPExtraTeams) do
        print(v.name) //will print all jobs names.
        print(v.command) //will print all jobs cmds.
    end
     
     
    Your Stalker likes this.
  6. Your Stalker

    Your Stalker New Member

    Thanks for the help but now I am getting an issue with restricting default teams. On the DarkRP forum is says "NOTE: This is only for the /job comand! The hook for changing to a pre-existing job is playerCanChangeTeam." In the page for the hook canChangeJob but the following code isn't doing anything when switching jobs in the F4 menu.

    Code (Text):

    if SERVER then
        hook.Add( "PlayerCanJoinTeam", "restrictDefaultJobs", function( ply, job )
            return false
        end )
    end
    Thanks!
     
  7. Matryan

    Matryan Well-Known Member

    Not sure what you mean but the correct hook is http://wiki.darkrp.com/index.php/Hooks/Server/playerCanChangeTeam
     
  8. Your Stalker

    Your Stalker New Member

    I confused playerCanChangeTeam with the PlayerCanJoinTeam hook that is part of Gmod, my bad guys :p
     
  9. Tomelyr

    Tomelyr Active Member

    a little help: Check if the hook exist in DarkRP. If yes, use it, if not, go to the gmod wiki. If the hook is there use it, if not find an hacky solution.
     

Share This Page