Problems That Don't Need Their Own Thread v3.0

One of my addons is causing my server to crash and I know which it is. Any ideas on how to approach fixing the issue? I’ve already scanned the server and client console for hints to the reason why but have no idea, and no it doesn’t use NWVars :stuck_out_tongue:


Well… there’s not much we can figure out without actually seeing the addon, or being given an idea of what it does and how you do it.

This question has literally been asked a billion times and every single time its the same answer: Disable ALL of your addons then re-enable them one by one until your server crashes.

He knows what add-on it is.

Oh whoops, misread it. Well if you know which it is, contact the author and get them to sort it out?

Tbh in that case i would ask on facepunch. With as much possible informations regarding your server to create an live near working environment to test the addon.
Maybe it isnt the addon itself, maybe it collides with an another addon.

Which addon is it? I’m asking in case the answer could help someone else.

Is there any way to tell if the server has crashed or closed improperly server-side? GM:ShutDown seems to only work when the server is terminated safely, and I’m looking for a way to dump/save data without losing it.

This isn’t as much of an error as much as it is a question. I’m looking into reading files that contain model locations. My question is how should I read the file that’s located in the gamemode’s folder?

file.Read(“gamemodes/file.txt”, “GAME”)?

Serverside, no. Due to the very nature of a “crash”, you can’t hook into it happening.
Best you can do is periodically save.
If you want to detect if a server has crashed the next time it starts up, though, you can write a file into DATA on GM:Initialize, delete the file on GM:ShutDown, and check if it exists on each start up. If it does, the server crashed.

Clientside, however, you can occasionally ping the server with a small net message or something to see if it responds. If it doesn’t, you’re either lagging or the server’s crashed. If you don’t get a response for more than, say, 60 seconds, you can safely assume the server’s crashed, and do something.

Is there a particular problem that stems from having too many hooks on a server? If so, how many would it take to cause this problem? I have no basis for this question, just curious.

Apart from the fact that each hook function will be called every time the hook fires if none of them return, there’s no particular “gotchas” you need to be careful of.

Just don’t attach anything stupidly expensive to hooks that get called a lot, and you should be alright.

Uh, okay so moving menus that start off screen work fine if it’s with width but starts at the very top of the screen and moves further down if you use height

Has anyone else experienced this?

Slides in off screen fine:

frame:SetSize(250, 100)
frame:SetPos(-250, 100)
frame:MoveTo(250, 100, 1, 0, 5)

Starts on screen and slides even further down:

frame:SetSize(250, 100)
frame:SetPos(500, -100)
frame:MoveTo(500, 100, 1, 0, 5)

Is SetPos clamping the value to 0 at minimum, or is MoveTo immediately snapping the panel to Y position 0 as soon as the animation starts?

(Logically, neither should be happening, but more information is always good.)

I’m trying to use GM:PlayerDeath and chat.AddText so that each time a player dies, it will print something to the chatbox. The problem is, PlayerDeath is serverside and chat.Addtext is clientside. Not sure what to do.

Net library.

use gameevents for no networking need.

hook.Add("entity_killed", "PlayerDeath", function(dat)
	local killer = Entity(dat.entindex_attacker);
	local inflictor = Entity(dat.entindex_inflictor);
	local victim = Entity(dat.entindex_killed);
	if(IsValid(victim) and IsValid(killer) and 
		victim:IsPlayer() and killer:IsPlayer()) then
		chat.AddText(killer:Nick().." killed "..victim:Nick());

You could either use net library, or the gameevent for that. I’m not really familiar with game events, though. So heres a solution using the net library.

Server side;

[lua]util.AddNetworkString “Death Notification”

hook.Add ( “PlayerDeath”, “Death Notification”,
function ( player, inflictor, attacker )
net.Start “Death Notification”

		net.WriteEntity ( player )
		net.WriteEntity ( attacker )

	net.Broadcast ( )


Client side;

[lua]net.Receive ( “Death Notification”,
function ( length, server )
local player = net.ReadEntity ( )
local attacker = net.ReadEntity ( )

	chat.AddText ( Color ( 100, 255, 100 ), player, " killed ", attacker )


Okay, I’ve found the problem: DFrame is hard-coded to not go above y0 for… whatever reason.

You see the code here:

If you still reaaaally want a DFrame that can do this, you can try overriding its Think function with a duplicate version of the one hosted on github (ideally with functionality you don’t need stripped out).