• Code crashes game.
    3 replies, posted
I have been working on a GM, and when I added a NLR type thing ( it just reminds you that you're dead, and have to wait until all teamates are dead or all opponents are eliminated before you can respawn) Here is my code cl_deathreminder.lua [lua] AddCSLuaFile("sv_deathreminder.lua") include( 'sv_deathreminber.lua' ) function DeathReminderTFW() local Death_Reminder_ = vgui.Create("DFrame") Death_Reminder_:SetSize(700,230) Death_Reminder_:Center() Death_Reminder_:SetTitle("Death Reminder ") Death_Reminder_:MakePopup() Death_Reminder_:ShowCloseButton( false ) local DPaneL1 = vgui.Create("DPanel", Death_Reminder_) DPaneL1:SetParent( Death_Reminder_ ) DPaneL1:SetSize(695, 150) DPaneL1:SetPos(3, 25) local Ok_Cool = vgui.Create("DButton", Death_Reminder_) Ok_Cool:SetParent( DPaneL1 ) Ok_Cool:SetSize(289.5, 42) Ok_Cool:SetPos(198, 181) Ok_Cool:SetText("Ok, Cool") Ok_Cool.DoClick = function() Death_Reminder_:Close() end end concommand.Add("DRTFW", DeathReminderTFW)[/lua] And here is my sv_deathreminder [lua] AddCSLuaFile("cl_deathreminder.lua") include( 'cl_deathreminber.lua' ) function DeathReminder(ply, cmd, args) ply:RunConsoleCommand("DRTFW") end hook.Add("PlayerDeath", "DeathPanel", DeathReminder) [/lua] When ever I run my game mode it crashes GMOD instantly, any ideas?
Idk if this is causing it, but you're including cl_deathreminber.lua on serverside when its clientside, "include( 'cl_deathreminber.lua' )". Remove that, you only need AddCSLuaFile, so the client downloads the file. [lua] AddCSLuaFile("cl_deathreminder.lua") include( 'cl_deathreminber.lua' ) -- Remove That! function DeathReminder(ply, cmd, args) ply:RunConsoleCommand("DRTFW") end hook.Add("PlayerDeath", "DeathPanel", DeathReminder) [/lua] Well, atleast I THINK your sv_deathreminder.lua is serverside, is it?
First of all you do not AddCSLuaFile serverside files. Also no need to include the clientside file from the serverside file. and no reason to include the serverside file from the clientside file. Please note that serverside files are [b]NOT[/b] sent to the client and clientside files [b]ARE[/b]. However, if the file is shared it [b]IS[/b].
[QUOTE=Dragge;21824403]Idk if this is causing it, but you're including cl_deathreminber.lua on serverside when its clientside, "include( 'cl_deathreminber.lua' )". Remove that, you only need AddCSLuaFile, so the client downloads the file. [lua] AddCSLuaFile("cl_deathreminder.lua") include( 'cl_deathreminber.lua' ) -- Remove That! function DeathReminder(ply, cmd, args) ply:RunConsoleCommand("DRTFW") end hook.Add("PlayerDeath", "DeathPanel", DeathReminder) [/lua] Well, atleast I THINK your sv_deathreminder.lua is serverside, is it?[/QUOTE] Yes, that would be why it has the player death hook and it's names sv_ =3 [editline]10:00PM[/editline] [QUOTE=Helix Alioth;21825943]First of all you do not AddCSLuaFile serverside files. Also no need to include the clientside file from the serverside file. and no reason to include the serverside file from the clientside file. Please note that serverside files are [b]NOT[/b] sent to the client and clientside files [b]ARE[/b]. However, if the file is shared it [b]IS[/b].[/QUOTE] So basically remove the include from both of them, and only leave the AddCSLuaFile in the sv_ . [editline]10:30PM[/editline] Hmm, still crashes as soon as I click start or whatever I don't know if it is that code, or something else in my gamemode, add me on steam at vypr11, or pm me I don't want to post my code in public.
Sorry, you need to Log In to post a reply to this thread.