Raised This Month: $12 Target: $400
 3% 

[TF2] Prevent Sentry Placement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 04-16-2017 , 12:55   [TF2] Prevent Sentry Placement
Reply With Quote #1

I've looked at a lot of different threads and tutorials on this site and others on how to block sentries from being placed. If someone else posted this, please delete this one but I couldn't find it after searching for a good 10 minutes.

Code:
// Block Sentries
public OnEntityCreated(iEnt, const String:classname[])
{
	if(!IsValidEntity(iEnt))
		return;
	
	if(StrEqual(classname, "obj_sentrygun"))
	{
		AcceptEntityInput(iEnt, "Kill");
	}
}
In-game this prevents the sentry blueprint from even showing up and I can't circumvent it through the build menu. I tried the Command Listener version but it could be circumvented.
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 04-16-2017 , 14:48   Re: [TF2] Prevent Sentry Placement
Reply With Quote #2

Set up a command listener, listen for the build command, then just kill the entity.

Last edited by 404UserNotFound; 04-16-2017 at 16:25.
404UserNotFound is offline
Pelipoika
Veteran Member
Join Date: May 2012
Location: Inside
Old 04-16-2017 , 15:04   Re: [TF2] Prevent Sentry Placement
Reply With Quote #3

Quote:
Originally Posted by abrandnewday View Post
Set up a command listener, listen for the build command, then just kill the entity.
No don't kill the entity, the whole purpose of a command listener block is that we don't get that far
__________________
Pelipoika is offline
404UserNotFound
BANNED
Join Date: Dec 2011
Old 04-16-2017 , 16:24   Re: [TF2] Prevent Sentry Placement
Reply With Quote #4

Quote:
Originally Posted by Pelipoika View Post
No don't kill the entity, the whole purpose of a command listener block is that we don't get that far
Oh yeah. Derp. Giving advice when you've just woken up within the past half hour is a bad idea lol.
404UserNotFound is offline
Requiesta
Senior Member
Join Date: May 2012
Location: Texas
Old 04-23-2017 , 00:28   Re: [TF2] Prevent Sentry Placement
Reply With Quote #5

What I ended up doing for the mod is both. I kill the entity on creation and block the command listener. Doing either alone seemed to create small windows for players to place sentries, somehow. Doing both seems to have completely blocked em.
__________________
YouTuber, Modder, Accountant, and somehow I still enjoy programming after all that.

Check out my YouTube Channel.
Requiesta is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:57.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode