Flash swep Rebirth creates errors when I try to play prop hunt.

These is the error it keeps giving me when I try to play prophunt with it installed:

File exists in two addons - possible conflicts! lua/includes/modules/momo/compat.lua (Morph Mod and The Flash SWEP Rebirth)

[ERROR] lua/autorun/server/tfsr_sv_speed.lua:12: Tried to use a NULL entity!

  1. GetClass - [C]:-1
  2. v - lua/autorun/server/tfsr_sv_speed.lua:12
    3. old_hook_call - lua/includes/modules/hook.lua:84
    4. unknown - lua/includes/modules/momo/compat.lua:23

I really like this mod and would hate to lose it. Any fix for this?

Post the code in


 tags.


File exists in two addons - possible conflicts! lua/includes/modules/momo/compat.lua (Morph Mod and The Flash SWEP Rebirth)

[ERROR] lua/autorun/server/tfsr_sv_speed.lua:12: Tried to use a NULL entity!
1. GetClass - [C]:-1
2. v - lua/autorun/server/tfsr_sv_speed.lua:12
3. old_hook_call - lua/includes/modules/hook.lua:84
4. unknown - lua/includes/modules/momo/compat.lua:23


Like that?

No, the code of the file that is erroring.

How do I find that?

Read the error. It’s the first filepath listed.

I followed the file path but it stops in the modules. I’m not seeing momo or a compat.lua.

Not the conflicting path, the filepath next to [ERROR].

There is no tfsr_sv_speed.lua in the server folder.

It’s in one of your addons.

I use the Steam Workshop so my addons folder has a bunch of GMA files.

Follow this tutorial to get the code: https://steamcommunity.com/sharedfiles/filedetails/?id=431638110



/*
	©2017 Metamorphics
	(STEAM_0:1:52851671 is the one and only author)
	Covered by Attribution-NonCommercial-NoDerivatives 4.0 International
	http://creativecommons.org/licenses/by-nc-nd/4.0/
	http://creativecommons.org/licenses/by-nc-nd/4.0/legalcode
*/

RunConsoleCommand("sv_maxvelocity", "10000")

hook.Add("Move", "tfsr_wallrun", function(ply, movdat)
	if IsValid(ply) and ply:Alive() and (ply:GetActiveWeapon():GetClass() == "tfsr_speedster" or ply:GetActiveWeapon():GetClass() == "tfsr_blackflash") then
		local tr = util.TraceLine({
			start = ply:GetShootPos(),
			endpos = ply:GetShootPos() + (ply:GetAimVector() * 150),
			mask = MASK_SOLID_BRUSHONLY,
		})
		if tr.Entity:IsWorld() and movdat:KeyDown(IN_SPEED) and tr.HitPos:Distance(ply:GetShootPos()) <= 50 then
			local ang = movdat:GetMoveAngles()
			local vel = movdat:GetVelocity()
			vel = vel + ang:Forward() * movdat:GetForwardSpeed()
			ply:SetRenderAngles(ang)
			movdat:SetVelocity(vel * 0.2)
		end
	end
end)


Is this what you mean?

Yes. The issue is that the code does not check if the active weapon is valid before using GetClass on it. The code should be:


hook.Add("Move", "tfsr_wallrun", function(ply, movdat)
	if movdat:KeyDown(IN_SPEED) and ply:Alive() then
		local wep = ply:GetActiveWeapon()

		if wep:IsValid() then
			local class = wep:GetClass()

			if class == "tfsr_speedster" or class == "tfsr_blackflash" then
				local shoot = ply:GetShootPos()
				local tr = util.TraceLine({
					start = shoot,
					endpos = shoot + ply:GetAimVector() * 150,
					mask = MASK_SOLID_BRUSHONLY,
					filter = ply
				})

				if tr.HitWorld and tr.HitPos:DistToSqr(shoot) <= 2500 then
					local ang = movdat:GetMoveAngles()
					ply:SetRenderAngles(ang)

					local forward = ang:Forward()
					forward:Mul(movdat:GetForwardSpeed())
					
					local vel = movdat:GetVelocity()
					vel:Add(forward)
					vel:Mul(0.2)

					movdat:SetVelocity(vel)
				end
			end
		end
	end
end)

So I just replace you code with what is currently there?

Yeah, you’ll have to recompile the GMA with the changes. I would link the fix to the author so he can publish it.

[editline]10th September 2017[/editline]

Make sure to only replace the hook portion. Keep the RunConsoleCommand call.

Thanks a ton. I posted a link to this on the mod page and hopefully the author will make this change.

Thanks for letting me know :slight_smile: