SWEP 'near wall' function

Does anyone remember what I gotta type on my script in order to get that working for a custom SWEP, on Garry’s Mod 10?
I got legit purchased version but stopped playing it since broken addons incident cause of 13 update and performance issues (yeah, my system is that crappy). My Steam ID is ‘warspectre’, you can verify if you want (http://steamcommunity.com/profiles/76561197996995480/)
In fact, there’re some releases out there that contain this function but it’s too much Lua code to find what’s the right one for me. Here I bring to you some resource for helping me easily:


Hoping for a profitable and soon reply; thank you very much for your attention.

what do you mean with “near wall” do you mean like “place it on a wall”?

I mean when I’m using a SWEP and I got a wall in front of me, it’s like there’s a collision and position changes according to some coordinates specified in the Lua script; something like:

SWEP.NearWallPos = Vector (-1.0416, -11.4198, -2.2259)
SWEP.NearWallAng = Vector (40.6435, -56.4456, -17.6906)

You mean that the “swep model” cant go through the wall?

[editline]31st July 2015[/editline]

if so, then:



I appreciate your help but that’s too generic for me. I am unable to understand what exactly I gotta type on my script to make desired effect work. Also, I can’t find ‘Entity:GetCollisionBounds’ anywhere on the resource scripts I provided, and SWEPs from there have the function working perfectly so I don’t think that’s correct.
What’s shown on ‘2:22’ sequence from following clip is what I want, just in case you didn’t comprehend well:

Also remember it’s for an older version of Garry’s Mod.

oh, with that you have to set angles, but I dont know how to check how close somebody is to a wall.

how do you have that q menu

its the old gmod Q menu.


Traces will allow you to check how close or far an entity is from the wall, however I think it would also affect if you were too close to the ground or other props, so it wouldn’t just be walls.

EDIT: 500th post, fuck me…

Not plenty sure if you noticed, but hey, that’s not helpful at all. I provided a link with the code I need inside a base, you only need to tell me what part is the one which is related to the specific function I want to implement for my custom SWEP. Damn…

Edited: I’m giving you an e-cookie if you solve my problem :cat:

We’re not going to take the weapon base that you gave us and then C+P code into it from other bases just because you can’t do it yourself, I am telling you what you can do to check how close you are to a wall and if you’re looking for free handouts then you might want to go to your nearest soup kitchen, because they’re not here.

You sound like a transgender :joy:

(User was permabanned for this post ("Troll" - Craptasket))

big meme reply

rifk spastic got so mad he made a video

if only you dedicated as much time as you did to make that video with this problem you might’ve found a solution :frowning: oh well

Use traces. Check the trace HitPos and test the DistToSqr() method with your player position, and compare that to a squared value. To make sure it’s a wall check if the trace .Entity is the world.

Nevermind. As you’re not willing to help, I give up on this project. So cheers.