AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [TF2] Prevent Sentry Placement (https://forums.alliedmods.net/showthread.php?t=296270)

Requiesta 04-16-2017 12:55

[TF2] Prevent Sentry Placement
 
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 :oops: 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.

404UserNotFound 04-16-2017 14:48

Re: [TF2] Prevent Sentry Placement
 
Set up a command listener, listen for the build command, then just kill the entity.

Pelipoika 04-16-2017 15:04

Re: [TF2] Prevent Sentry Placement
 
Quote:

Originally Posted by abrandnewday (Post 2512757)
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

404UserNotFound 04-16-2017 16:24

Re: [TF2] Prevent Sentry Placement
 
Quote:

Originally Posted by Pelipoika (Post 2512762)
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.

Requiesta 04-23-2017 00:28

Re: [TF2] Prevent Sentry Placement
 
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.


All times are GMT -4. The time now is 04:33.

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