diff --git a/lua/map_scripts/maps/gm_darkfusion.lua b/lua/map_scripts/maps/gm_darkfusion.lua index 650504d..5739530 100644 --- a/lua/map_scripts/maps/gm_darkfusion.lua +++ b/lua/map_scripts/maps/gm_darkfusion.lua @@ -27,4 +27,22 @@ local entIDs = { hook.Add( "CFC_MapScripts_PostMapEntsSpawn", "CFC_MapScripts_darkfusion_removeadminbuttons", function() MapScripts.Utils.RemoveButtonsByID( entIDs ) +end ) + + +-- only allow pvpers to mess with the map for maximum LARP +if not CFCPvp then return end + +local tooFarDistanceSqr = 200^2 + +hook.Add( "PlayerUse", "CFC_MapScripts_darkfusion_BlockBuilderUseOnMapButtons", function( ply, ent ) + if ent:MapCreationID() == -1 then return end + if not string.find( ent:GetClass(), "button" ) then return end -- not a button? who cares! + + if ply:IsInBuild() then ply:ChatPrint( "You must be in PVP to press darkfusion map buttons!" ) return false end -- pvpers only! + + local plyPos = ply:GetPos() + if plyPos:DistToSqr( ent:GetPos() ) > tooFarDistanceSqr then return false end -- too far away, probably a wire user, etc + + -- all good, let them use the button end ) \ No newline at end of file