• cl_init fail
    29 replies, posted
After countless re-uploads and such, I've checked in the console and still it fails to do anything when I press F1, and it claims the problem is because it couldn't open cl_init.lua or something like that, and I'm not sure how that's possible, so here's the code for cl_init.lua. I was hoping someone could figure out the problem with me. [code] include( 'shared.lua' ) function personalFinances financeOwnPanel = vgui.Create( "DFrame" ) financeOwnPanel:SetPos( 300, 300 ) financeOwnPanel:SetSize( 400, 400 ) financeOwnPanel:SetTitle( "Personal Finances" ) financeOwnPanel:SetVisible( true ) financeOwnPanel:SetDraggable( true ) financeOwnPanel:ShowCloseButton( true ) financeOwnPanel:MakePopup() financeOwnSave = vgui.Create( "DButton" ) financeOwnSave:SetParent( financeOwnPanel ) financeOwnSave:SetPos( 30, 360 ) financeOwnSave:SetSize( 20, 30 ) financeOwnSave:SetText( "Save" ) financeOwnSave.DoClick = function RunConsoleCommand( "saveProgress" ) end end concommand.Add( "personalFinance", personalFinance ) hook.Add( "ShowHelp", "Finances", personalFinances ) [/code] [highlight](User was banned for this post ("Wrong section" - mahalis))[/highlight]
Post the exact error, pasted from the console. [editline]09:30PM[/editline] Also, put () after function personalFinances
It didn't give an exact error, other then cl_init.lua not being able to be opened. But I can however post the entire console code, but also your right I missed that. [editline]07:07PM[/editline] got any idea what else it might be? I fixed that and it still didn't work
Well here's the code for the rest of the files if anyone can help me. If you can, please help me. init.lua [code] AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "cl_init.lua" ) include( 'shared.lua' ) include( 'cl_init.lua' ) moneyOOCStart = 2000 walletStart = 100 function beginSpawn( ply ) moneyOOC = ply:GetPData("OMoney") Player:StripWeapons() if moneyOOC == nil then ply:SetPData("moneyOOC", moneyOOCStart) ply:SetPData("wallet", walletStart) else ply:SetOOCMoney( OMoney ) end end meta = FindMetaTable("Player") --Get the meta table of player function meta:AddOMoney(amount) current_cash = self:GetOMoney() self:SetOMoney( current_cash + amount ) end function meta:SetWallet(total) self:SetNetworkedInt( "wallet", total ) self:SaveWallet() end function meta:SetOMoney(amount) self:SetNetworkedInt( "OMoney", amount ) self:SaveMoney() end function meta:SaveMoney() cash = self:GetOMoney() self:SetPData("OMoney", cash) end function meta:SaveOMoneyTXT() file.Write(gmod.GetGamemode().Name .."/Money/".. string.gsub(self:SteamID(), ":", "_") ..".txt", self:GetOMoneyString()) end function meta: function meta:SaveOOCMoney() OMoney = self:GetOMoney() function meta:TakeMoney(amount) --Add money function here self:AddMoney(-amount) end function meta:GetOMoney() return self:GetNetworkedInt( "OMoney" ) end hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", beginSpawn ) hook.Add( "ShowHelp", "Finances", personalFinances ) concommand.Add( "saveProgress", SaveMoney ) [/code] shared.lua [code] GM.Name = "Like RP" GM.Author = "General Pancakes" GM.Email = "" GM.Website = "www.pancakelandcentral.webs.com" team.SetUp( 1, "Tier I Law Enforcement", Color( 0, 0, 255, 255 ) ) team.SetUp( 2, "Tier II Law Enforcement", Color( 200, 200, 200, 255 ) ) team.SetUp( 3, "Tier III Law Enforcement", Color( 0, 255, 0, 255 ) ) team.SetUp( 4, "Outlaw", Color( 0, 0, 0, 255 ) ) team.SetUp( 5, "EMS", Color ( 255, 0, 0, 255 ) ) team.SetUp( 6, "Fire Department", Color ( 255, 0, 0, 255 ) ) team.SetUp( 7, "Corporation", Color ( 0, 0, 0, 255 ) ) [/code]
Post the error in your console where it says it can't load the file.
Alright. It doesn't say a specific line or something like that, but I'll post it. [code] Couldn't include file 'LikeRP/gamemode/cl_init.lua' (File not found) ********************************************** ********************************************** ********** COULDN'T LOAD GAMEMODE!! ********** ********************************************** ********************************************** There was a problem opening the gamemode file 'LikeRP/gamemode/cl_init.lua' [/code] Those are the only lines that are stating any errors, but anyways that's it. Let me know if there's anything else I can do. I don't see why though it doesn't just see the file, its right there.
Remove include( 'cl_init.lua' ) from init.lua
Hmmmm. If this works, and the F1 Thing too, I will slap myself.
Probably not a good idea to be giving out the entire coding of all your files, if you don't want you gamemode stolen =[
Well, this gamemode is going to be released publicly. But it still isn't working. [editline]10:15PM[/editline] Anyone have any more ideas. :(
Did you AddCSLuaFile the cl_init.lua file?
You have a random "function meta:" You forgot to end the "SaveOOCMoney" function.
Alright, I'll see if those fix the problem when I get home. Wait, for the function thing what about [code] meta = FindMetaTable("Player") --Get the meta table of player [/code] ?
That part is fine. It's the random function between the following two functions: [lua]function meta:SaveOOCMoney()[/lua] and [lua]function meta:SaveOMoneyTXT()[/lua]
Yeah, I've got some patching up to do. But my main concern is getting derma to pop-up when F1 is pressed. :/
Copy the error from your server, not your client.
[code] AddCSLuaFile( "shared.lua" ) AddCSLuaFile( "cl_init.lua" ) include( 'shared.lua' ) moneyOOCStart = 2000 walletStart = 100 function beginSpawn( ply ) moneyOOC = ply:GetPData("OOCMoney") Player:StripWeapons() if moneyOOC == nil then ply:SetPData("OOCMoney", moneyOOCStart) else ply:SetOOCMoney( OMoney ) end end meta = FindMetaTable("Player") --Get the meta table of player function meta:AddOOCMoney(amount) current_cash = self:GetOMoney() self:SetOOCMoney( current_cash + amount ) end function meta:SetOOCMoney(amount) self:SetNetworkedInt( "OOCMoney", amount ) self:SaveOOCMoney() end function meta:SaveOOCMoney() cash = self:GetOMoney() self:PData("OOCMoney", cash) end function meta:SaveOOCMoneyTXT() file.write(gmod.GetGamemode().Name .."/Money/".. string.gsub(self:SteamID(), ":", "_") ..".txt", self:GetMoneyString()) end function meta:TakeOOCMoney(amount) self:AddOOCMoney(-amount) end function meta:GetOOCMoney() return self:GetNetworkedInt( "OOCMoney" ) end hook.Add( "PlayerInitialSpawn", "playerInitialSpawn", beginSpawn ) hook.Add( "ShowHelp", "Finances", personalFinances ) concommand.Add( "saveProgress", SaveOOCMoney ) [/code] That's the code I got now, and it still isn't working. :( [editline]06:10PM[/editline] Oh and I checked it, and it gave me some error on line 50. :/
file.Write not file.write
D'OUGH! God damn you case-sensitive machine! [editline]07:45PM[/editline] Okay I think I've got it narrowed down to this one error, and before you say it's because the function doesn't have the paranthesis, I put that in and it still didn't work. But this is the error the console gave me; [code] ikeRP\gamemode/cl_init.lua:20: '(' expected near 'RunConsoleCommand' [/code]
[QUOTE=TheNerdPest14;21453905]D'OUGH! God damn you case-sensitive machine! [editline]07:45PM[/editline] Okay I think I've got it narrowed down to this one error, and before you say it's because the function doesn't have the paranthesis, I put that in and it still didn't work. But this is the error the console gave me; [code] ikeRP\gamemode/cl_init.lua:20: '(' expected near 'RunConsoleCommand' [/code][/QUOTE] [lua]include( 'shared.lua' ) function personalFinances() -- < other error financeOwnPanel = vgui.Create( "DFrame" ) financeOwnPanel:SetPos( 300, 300 ) financeOwnPanel:SetSize( 400, 400 ) financeOwnPanel:SetTitle( "Personal Finances" ) financeOwnPanel:SetVisible( true ) financeOwnPanel:SetDraggable( true ) financeOwnPanel:ShowCloseButton( true ) financeOwnPanel:MakePopup() financeOwnSave = vgui.Create( "DButton" ) financeOwnSave:SetParent( financeOwnPanel ) financeOwnSave:SetPos( 30, 360 ) financeOwnSave:SetSize( 20, 30 ) financeOwnSave:SetText( "Save" ) financeOwnSave.DoClick = function() -- < there was the error RunConsoleCommand( "saveProgress" ) end end concommand.Add( "personalFinance", personalFinance ) hook.Add( "ShowHelp", "Finances", personalFinances )[/lua]
Like I said, I put that in there and it still didn't work. :/
[QUOTE=TheNerdPest14;21455610]Like I said, I put that in there and it still didn't work. :/[/QUOTE] Fixed it replace the file.
I did fix it, and it should be working but nothing still comes up when F1 Is pressed.
Post your current cl_init code.
This is it so far; [code] include( 'shared.lua' ) function personalFinances() financeOwnPanel = vgui.Create( "DFrame" ) financeOwnPanel:SetPos( 300, 300 ) financeOwnPanel:SetSize( 400, 400 ) financeOwnPanel:SetTitle( "Personal Finances" ) financeOwnPanel:SetVisible( true ) financeOwnPanel:SetDraggable( true ) financeOwnPanel:ShowCloseButton( true ) financeOwnPanel:MakePopup() financeOwnSave = vgui.Create( "DButton" ) financeOwnSave:SetParent( financeOwnPanel ) financeOwnSave:SetPos( 30, 360 ) financeOwnSave:SetSize( 20, 30 ) financeOwnSave:SetText( "Save" ) financeOwnSave.DoClick = function() RunConsoleCommand( "saveProgress" ) end end concommand.Add( "personalFinance", personalFinances ) hook.Add( "ShowHelp", "Finances", personalFinances ) [/code]
Can't anybody help?
I dont know about hooks, but shouldnt it be [code]hook.Add( "ShowHelp", "ShowHelp", personalFinances )[/code]
Ah, so maybe I just need to put it back in init.lua , and then test now that it seems I've gotten the bugs ironed out. At least I hope I have, there shouldn't be anymore showing up after this.
It still isn't working. :/
Sorry, you need to Log In to post a reply to this thread.