SERVER: Add trigger_stuffcmd

This commit is contained in:
Steam Deck User 2023-03-28 22:24:56 -04:00
parent 5c3f23dc47
commit 6df8c971e8

View file

@ -240,6 +240,32 @@ void() trigger_activator =
self.touch = trigger_activator_touch; self.touch = trigger_activator_touch;
} }
#define SPAWNFLAG_TRIGGERCMD_NOPLAYER 1
#define SPAWNFLAG_TRIGGERCMD_NOSPEC 2
void() trigger_stuffcmd_touch =
{
// First, lets make sure this is a client
if (other.classname != "player" && other.classname != "spectator")
return;
// Don't interact with players
if ((self.spawnflags & SPAWNFLAG_TRIGGERCMD_NOPLAYER) && other.classname == "player")
return;
// Don't interact with spectators
if ((self.spawnflags & SPAWNFLAG_TRIGGERCMD_NOSPEC) && other.classname == "spectator")
return;
// Run the command.
stuffcmd(other, strcat(self.message, "\n"));
}
void() trigger_stuffcmd =
{
InitTrigger();
self.touch = trigger_stuffcmd_touch;
}
/* =================== /* ===================
Custom Teddy Triggers Custom Teddy Triggers
===================*/ ===================*/