(This seems very basic to me, but I haven't been able to find it in lots of searching)
In CG_Missile() in cg_ents.c, my mod has smoke grenades that you can throw. I need to do:
switch ( PlayerTeam ) {
case TEAM_RED:
etc...
But I don't know how to get the player's team? I tried to get clientnum and check from that but it seems to be the number of the grenade itself not the player.
I want the smoke to be blue when the player who threw the smoke grenade is on the blue team, and red when he's on the red team, and the only part I haven't figured out about that is knowing which team they are on.
how do you detect what team a player is on that threw a gren
Re: how do you detect what team a player is on that threw a gren
ent->client->sess.sessionTeam
this gives you an int which matches any value in the team_t enum:
A player's team is TEAM_FREE in non-team games.
this gives you an int which matches any value in the team_t enum:
Code: Select all
typedef enum {
TEAM_FREE,
TEAM_RED,
TEAM_BLUE,
TEAM_SPECTATOR,
TEAM_NUM_TEAMS
} team_t;
Re: how do you detect what team a player is on that threw a gren
I think this is what you're looking for:
1) In G_missile.c
At the end of *fire_grenade (right before 'return bolt;') add:
2) In CG_ents.c
In function CG_missile (for example after 'ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW;') add:
1) In G_missile.c
At the end of *fire_grenade (right before 'return bolt;') add:
Code: Select all
if (self->client)
bolt->s.generic1 = self->client->sess.sessionTeam;
In function CG_missile (for example after 'ent.renderfx = weapon->missileRenderfx | RF_NOSHADOW;') add:
Code: Select all
if( s1->generic1 == TEAM_BLUE ) {
ent.customShader = cgs.media.grenadeShaderBlueSmoke; //Or something...
} else {
....and something
}