• DarkRP | Job making error
    17 replies, posted
Ok so I finished my job shit, now I restart. Join, job is not there. Wtf? So I type in its unique command, then I can't open F4 because of JobTable error. init.lua [CODE]AddCSLuaFile() include( "vgui.lua" ) local locations = {} function Gotjobcreator() local jobcreator = net.ReadTable() if not file.Exists( "data/the-creator-logs", "GAME" ) then file.CreateDir( "the-creator-logs" ) file.CreateDir( "the-creator-logs/jobs" ) file.Write( "the-creator-logs/read.txt", 'DO NOT DELETE THIS FILE, UNLESS YOU DO NOT WANT YOUR CUSTOM, SWEPS/WEAPONS, JOBS and MORE!' ) end file.CreateDir( "the-creator-logs/jobs/"..jobcreator.name ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/color.txt", jobcreator.color ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/model.txt", jobcreator.model ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/description.txt", jobcreator.description ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/salary.txt", jobcreator.salary ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/category.txt", jobcreator.category ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/max.txt", jobcreator.max ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/admin.txt", jobcreator.admin ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/vote.txt", tostring(jobcreator.vote) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/license.txt", tostring(jobcreator.license) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/demote.txt", tostring(jobcreator.demote) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/vip.txt", tostring(jobcreator.vip) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/medic.txt", tostring(jobcreator.medic) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/chief.txt", tostring(jobcreator.chief) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/cook.txt", tostring(jobcreator.cook) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/mayor.txt", tostring(jobcreator.mayor) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/weapons.txt", tostring(jobcreator.weapon) ) file.Write( "the-creator-logs/jobs/"..jobcreator.name.."/hobo.txt", tostring(jobcreator.hobo) ) end net.Receive( "CreateJob", Gotjobcreator ) local function Init() local files, directories = file.Find( "the-creator-logs/jobs/*", "DATA" ) for k,v in pairs( directories ) do table.insert( locations, "the-creator-logs/jobs/"..v ) end for k,v in pairs( locations ) do if SERVER then -- Jobs _G["TEAM_" .. string.upper( directories[k] )] = DarkRP.createJob( directories[k], { color = string.ToColor( file.Read( v.."/color.txt", "DATA" ) ), model = string.Explode( ", ", file.Read( v.."/model.txt", "DATA" ) ), description = file.Read( v.."/description.txt", "DATA" ), weapons = string.Explode( ", ", file.Read( v.."/weapons.txt", "DATA" ) ), command = tostring(directories[k]), max = tonumber(file.Read( v.."/max.txt", "DATA" )), -- at most 70% of the players can have this job. Set to a whole number to set an absolute limit. salary = tonumber(file.Read( v.."/salary.txt", "DATA" )), admin = tonumber(file.Read( v.."/admin.txt", "DATA" )), --vote = tonumber(file.Read( v.."/vote.txt", "DATA" )), hasLicense = tonumber(file.Read( v.."/license.txt", "DATA" )), category = tostring(file.Read( v.."/category.txt", "DATA" )), -- The name of the category it is in. Note: the category must be created! candemote = tonumber(file.Read( v.."/demote.txt", "DATA" )), medic = tonumber(file.Read( v.."/medic.txt", "DATA" )), chief = tonumber(file.Read( v.."/chief.txt", "DATA" )), mayor = tonumber(file.Read( v.."/mayor.txt", "DATA" )), hobo = tonumber(file.Read( v.."/hobo.txt", "DATA" )), cook = tonumber(file.Read( v.."/cook.txt", "DATA" )), }) end end end hook.Add( "Initialize", "Init", Init ) if SERVER then util.AddNetworkString( "cstudio" ) end hook.Add( "PlayerSay", "CStudios", function( ply, text, team ) if ( text == "!c-s" ) then if ply:IsAdmin() then net.Start( "cstudio" ) net.Send( ply ) return ""; else ply:ChatPrint( "You dont have access!" ) end end end );[/CODE] vgui.lua [CODE]AddCSLuaFile() local files, directories = file.Find( "the-creator-logs/jobs/*", "DATA" ) if SERVER then util.AddNetworkString( "CreateJob" ) end net.Receive( "cstudio", function() local frame = vgui.Create( "DFrame" ) frame:SetSize( 500, 600 ) frame:SetTitle( "Creator Studio" ) frame:MakePopup() frame:Center() local Scroll = vgui.Create( "DScrollPanel", frame ) //Create the Scroll panel Scroll:SetSize( 355, 200 ) Scroll:SetPos( 50, 100 ) local List = vgui.Create( "DIconLayout", Scroll ) List:SetSize( 340, 200 ) List:SetPos( 0, 0 ) List:SetSpaceY( 5 ) //Sets the space in between the panels on the X Axis by 5 List:SetSpaceX( 5 ) //Sets the space in between the panels on the Y Axis by 5 local DButton1 = vgui.Create( "DButton", frame ) DButton1:SetPos( 50, 40 ) DButton1:SetText( "Add" ) DButton1:SetSize( 120, 60 ) DButton1.DoClick = function() local frame2 = vgui.Create( "DFrame" ) frame2:SetSize( 500, 600 ) frame2:SetTitle( "Creator Studio - Add" ) frame2:MakePopup() frame2:Center() -- Name local name = vgui.Create( "DTextEntry", frame2 ) -- create the form as a child of frame name:SetPos( 80, 25 ) name:SetSize( 360, 15 ) name:SetText( "" ) local namepanel = vgui.Create( "DPanel", frame2 ) namepanel:SetPos( 25, 25 ) -- Set the position of the panel namepanel:SetSize( 50, 15 ) -- Set the size of the panel local nametext = vgui.Create( "DLabel", namepanel ) nametext:SetPos( 10, 0 ) nametext:SetText( "Name" ) -- Set the text of the label nametext:SizeToContents() nametext:SetDark( 1 ) -- Color local colors = vgui.Create( "DTextEntry", frame2 ) -- create the form as a child of frame colors:SetPos( 75, 50 ) colors:SetSize( 155, 15 ) colors:SetText( "255 255 255" ) local colorpanel = vgui.Create( "DPanel", frame2 ) colorpanel:SetPos( 25, 50 ) -- Set the position of the panel colorpanel:SetSize( 50, 20 ) -- Set the size of the panel local colortext = vgui.Create( "DLabel", colorpanel ) colortext:SetPos( 10, 0 ) colortext:SetText( "Color" ) -- Set the text of the label colortext:SizeToContents() colortext:SetDark( 1 ) -- Player Model local model = vgui.Create( "DTextEntry", frame2 ) -- create the form as a child of frame model:SetPos( 85, 75 ) model:SetSize( 360, 15 ) model:SetText( "ex: models/player/alyx.mdl, models/player/breen.mdl" ) local modelpanel = vgui.Create( "DPanel", frame2 ) modelpanel:SetPos( 25, 75 ) -- Set the position of the panel modelpanel:SetSize( 50, 15 ) -- Set the size of the panel local modeltext = vgui.Create( "DLabel", modelpanel ) modeltext:SetPos( 10, 0 ) modeltext:SetText( "Models" ) -- Set the text of the label modeltext:SizeToContents() modeltext:SetDark( 1 ) -- Description local description = vgui.Create( "DTextEntry", frame2 ) -- create the form as a child of frame description:SetPos( 110, 100 ) description:SetSize( 350, 15 ) description:SetText( "" ) local descriptionpanel = vgui.Create( "DPanel", frame2 ) descriptionpanel:SetPos( 25, 100 ) -- Set the position of the panel descriptionpanel:SetSize( 75, 15 ) -- Set the size of the panel local descriptiontext = vgui.Create( "DLabel", descriptionpanel ) descriptiontext:SetPos( 10, 0 ) descriptiontext:SetText( "Description" ) -- Set the text of the label descriptiontext:SizeToContents() descriptiontext:SetDark( 1 ) -- Max Players local max = vgui.Create( "DTextEntry", frame2 ) -- create the form as a child of frame max:SetPos( 75, 125 ) max:SetSize( 50, 15 ) max:SetText( "" ) local maxpanel = vgui.Create( "
Can you please post the code for the job that you made?
[QUOTE=Slyde;51410504]Can you please post the code for the job that you made?[/QUOTE] There is no code, it makes the job automatically. This is been DUMB x4 because people dont understand what im making. And it used to work, now it doesnt. I use the vgui, and the vgui sends shit to the serverside and creates all these files then reads them and adds them on initialize. The job code is there. [editline]23rd November 2016[/editline] Oh and the job works, just when you type the command you become the job and the F4 menu disables its self. Thats all, that is wrong. [editline]23rd November 2016[/editline] [DarkRP] 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
You could add debugs to DarkRP where the error is coming from. Youre probably making the jobTable nil or something because its failing to read properly
[QUOTE=Klaes4Zaugen;51415222]You could add debugs to DarkRP where the error is coming from. Youre probably making the jobTable nil or something because its failing to read properly[/QUOTE] True, I could try that. But, I really think its the DarkRP f4 menu and shit. You can type command tick, then you cant look at f4. On F4 before typing command there is nothing. You get everything the job gives with the command. I have no idea. [editline]23rd November 2016[/editline] o.o
[QUOTE=jacobcooper18;51415067]There is no code, it makes the job automatically. This is been DUMB x4 because people dont understand what im making. And it used to work, now it doesnt. I use the vgui, and the vgui sends shit to the serverside and creates all these files then reads them and adds them on initialize. The job code is there. [editline]23rd November 2016[/editline] Oh and the job works, just when you type the command you become the job and the F4 menu disables its self. Thats all, that is wrong. [editline]23rd November 2016[/editline] [DarkRP] 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[/QUOTE] make that 6, also he was asking for the code that gets generated..
[QUOTE=Lunaversity;51415548]make that 6, also he was asking for the code that gets generated..[/QUOTE] When you type it in, its your unique. No joke, just chuck these in files. And test it yourself..
[QUOTE=jacobcooper18;51415649]When you type it in, its your unique. No joke, just chuck these in files. And test it yourself..[/QUOTE] wat isn't this a darkrp job creator? show us the files that are generated
[QUOTE=Lunaversity;51415708]wat isn't this a darkrp job creator? show us the files that are generated[/QUOTE] Oh lol [editline]23rd November 2016[/editline] It might be the fact im using tonumber for the statements that should be False. (So I change to tostring) and it kinda works now. [editline]23rd November 2016[/editline] [CODE] vote = tonumber(file.Read( v.."/vote.txt", "DATA" )), hasLicense = tonumber(file.Read( v.."/license.txt", "DATA" )), category = tostring(file.Read( v.."/category.txt", "DATA" )), -- The name of the category it is in. Note: the category must be created! candemote = tonumber(file.Read( v.."/demote.txt", "DATA" )), medic = tonumber(file.Read( v.."/medic.txt", "DATA" )), chief = tonumber(file.Read( v.."/chief.txt", "DATA" )), mayor = tonumber(file.Read( v.."/mayor.txt", "DATA" )), hobo = tonumber(file.Read( v.."/hobo.txt", "DATA" )), cook = tonumber(file.Read( v.."/cook.txt", "DATA" )),[/CODE] All there is either False or True
ok let's take baby steps then: your script creates files and writes data to them after u save or whatever, can u show us a generated job file?? (the wholeeee thing too)
[QUOTE=Lunaversity;51415947]ok let's take baby steps then: your script creates files and writes data to them after u save or whatever, can u show us a generated job file?? (the wholeeee thing too)[/QUOTE] Ok.. [IMG]http://i.imgur.com/M8gh4fT.png[/IMG] [IMG]http://i.imgur.com/ssNC0TX.png[/IMG] [editline]23rd November 2016[/editline] This is created perfectly, just read wrong I guess.
good good we're making progress now. now put all of those files into a pastebin or screenshot them (if you screenshot them use [.t] without the period) (also I recommend writing it all into 1 file instead of separate of other files)
You sir need to read up about JSON, why are there so many files for all jobs? They should be one
[url]http://wiki.garrysmod.com/page/util/TableToJSON[/url]
Shhh don't tell him, i don't want to have competition.. jk, he does not have any chance.
[QUOTE=pierre0158;51416713]Shhh don't tell him, i don't want to have competition.. jk, he does not have any chance.[/QUOTE] This is not relevant at all. If I could report you, I would, but I am not intending on selling this script, and if you do. Then I will report all rights that it started with me, because you know. You dont go on someones page that is not about winning or losing just needing help, but you saying its a competition. Please get an admin ...
[QUOTE=jacobcooper18;51419960]This is not relevant at all. If I could report you, I would, but I am not intending on selling this script, and if you do. Then I will report all rights that it started with me, because you know. You dont go on someones page that is not about winning or losing just needing help, but you saying its a competition. Please get an admin ...[/QUOTE] you have no rights on job creators hell these where made wayyy before you even joined facepunch sauce: [url]https://scriptfodder.com/scripts/view/3071/[/url]
[QUOTE=Lunaversity;51420005]you have no rights on job creators hell these where made wayyy before you even joined facepunch sauce: [url]https://scriptfodder.com/scripts/view/3071/[/url][/QUOTE] I am not here for comp, I am here for help...
Sorry, you need to Log In to post a reply to this thread.