Jump to content

Command for Invisibility


Go to solution Solved by Raz0r,

Recommended Posts

Posted

What I'm trying to do is make an admin command to make the player invisible to others. I've been searching around for things that could do this, but I haven't had any luck. I noticed this: ->s.eFlags = EF_NODRAW; but it appears that it doesn't affect players. Could someone point me in the right direction?

Posted

Unfortunately it's not that simple as that uses Quake 3's invisible powerup, which is not in JKA. I suppose I could try to bring Q3's invisible powerup code over though. Thanks for those.

Posted

Well there is already an item in JKA to make you "kinda" invisible (cloaking). Maybe you can use that. Afaik it pretty much uses the Q3 cloak powerup

Posted

Well there is already an item in JKA to make you "kinda" invisible (cloaking). Maybe you can use that. Afaik it pretty much uses the Q3 cloak powerup

It just applies a shader though, rather than making you invisible. I suppose you could just apply a shader that makes the player model 100% transparent though.

  • Solution
Posted

Invisible, non-solid, client-predictable ghosts. They are not networked to any other clients, rendering wall-hacks ineffective.

Incomplete, but mostly functional.

You may also want to hide entities related to them such as their weapon's shots (by setting ent->r.svFlags |= SVF_SINGLECLIENT and ent->r.singleClient)

 

 

// g_cmds.c
   if ( targ->client->pers.adminData.isGhost )
   {
       targ->client->pers.adminData.isGhost = qfalse;
       targ->r.contents = CONTENTS_SOLID;
       targ->clipmask = CONTENTS_SOLID|CONTENTS_BODY;
       targ->s.trickedentindex = 0; targ->s.trickedentindex2 = 0; //This is entirely for client-side prediction. Please fix me.
       trap_SendServerCommand( targetClient, "cp \"^5Unghosted\n\"" );
   }
   else
   {
       targ->client->pers.adminData.isGhost = qtrue;
       targ->r.contents = CONTENTS_BODY;
       targ->clipmask = 267009/*CONTENTS_SOLID*/;
       {//This is *entirely* for client-side prediction. Do not rely on it. Please fix me.
           targ->client->ps.fd.forceMindtrickTargetIndex = ~(1<<targetClient);
           targ->client->ps.fd.forceMindtrickTargetIndex2 = ~(1<<targetClient);
       }
       trap_SendServerCommand( targetClient, "cp \"You are now a ^5ghost\n\"" );
   }

 

// bg_pmove.c
void PM_AddTouchEnt( int entityNum ) {

//...

#ifdef QAGAME
   if ( ((gentity_t *)pm_entSelf)->client->pers.adminData.isGhost )
       return;
#endif

 

// bg_slidemove.c
qboolean PM_ClientImpact( trace_t *trace )

// ...

   if ( ((gentity_t *)pm_entSelf)->client->pers.adminData.isGhost )
       return qfalse;

 

// g_active.c
static void G_UpdateForceSightBroadcasts ( gentity_t *self )

// ...

       //    Ghosts are handled later
       if ( ent->client->pers.adminData.isGhost )
           continue;

 

// g_active.c
void G_UpdateClientBroadcasts ( gentity_t *self )

// ...

   G_UpdateForceSightBroadcasts ( self );

   //FIXME: implement broadcastClients functionality instead of SVF_SINGLECLIENT
   if ( self->client->pers.adminData.isGhost )
   {
       self->r.svFlags |= SVF_SINGLECLIENT;
       self->r.singleClient = self->s.number;
   }
   else
       self->r.svFlags &= ~SVF_SINGLECLIENT;

 

// g_active.c
void ClientThink_real( gentity_t *ent ) {

// ...

   pm.cmd = *ucmd;

   if ( pm.ps->pm_type == PM_DEAD ) {
       pm.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;
   }
   else if ( ent->r.svFlags & SVF_BOT ) {
       pm.tracemask = MASK_PLAYERSOLID | CONTENTS_MONSTERCLIP;
   }
   else {
       pm.tracemask = MASK_PLAYERSOLID;
       if ( ent->client->pers.adminData.isGhost )
           pm.tracemask = 267009/*MASK_DEADSOLID*/;
   }

   pm.trace = trap_Trace;

// ...

   {
       int savedMask = pm.tracemask;
       if ( ent->client->pers.adminData.isGhost )
       {
           pm.tracemask = CONTENTS_SOLID;
           ent->r.contents = 0;
       }

       Pmove (&pm);

       pm.tracemask = savedMask;
   }

   if (ent->client->solidHack)
   {

// ...

   // link entity now, after any personal teleporters have been used
   trap_LinkEntity (ent);
   //Raz: Nor for ghosts
   if ( !ent->client->noclip && !ent->client->pers.adminData.isGhost ) {
       G_TouchTriggers( ent );
   }

 

// w_force.c
void WP_ForcePowersUpdate( gentity_t *self, usercmd_t *ucmd )

// ...

   //Raz: Don't unset the tricked ents if they're a ghost, they're used for prediction in the JA++ client
   if (!self->client->pers.adminData.isGhost && !(self->client->ps.fd.forcePowersActive & (1 << FP_TELEPATHY)))
   { //clear the mindtrick index values
       self->client->ps.fd.forceMindtrickTargetIndex = 0;
       self->client->ps.fd.forceMindtrickTargetIndex2 = 0;
       self->client->ps.fd.forceMindtrickTargetIndex3 = 0;
       self->client->ps.fd.forceMindtrickTargetIndex4 = 0;
   }

 

Fighter likes this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...