Exemple #1
0
/*
=================
ClientCommand
=================
*/
void ClientCommand (edict_t *ent)
{
	char	*cmd;

	if (!ent->client)
		return;		// not fully in game yet

	cmd = gi.argv(0);

	// if we're viewing thru the camera, only allow some things to happen
	if (ent->client->zCameraTrack && !level.intermissiontime)
	{
		if (Q_stricmp (cmd, "putaway") == 0)
			Cmd_PutAway_f(ent);
		else if (Q_stricmp(cmd, "use") == 0)
		{
			if (Q_stricmp(gi.args(), "Visor") == 0)
				Cmd_Use_f(ent);
		}
		else if (Q_stricmp (cmd, "invuse") == 0)
		{
			// only use the visor
			if (ent->client->pers.selected_item == ITEM_INDEX(FindItem("Visor")))
				Cmd_InvUse_f (ent);
		}
		else if (Q_stricmp (cmd, "invnext") == 0)
			SelectNextItem (ent, -1);
		else if (Q_stricmp (cmd, "invprev") == 0)
			SelectPrevItem (ent, -1);
	
		return;
	}

	if (Q_stricmp (cmd, "players") == 0)
	{
		Cmd_Players_f (ent);
		return;
	}
	if (Q_stricmp (cmd, "say") == 0)
	{
		Cmd_Say_f (ent, false, false);
		return;
	}
	if (Q_stricmp (cmd, "say_team") == 0)
	{
		Cmd_Say_f (ent, true, false);
		return;
	}
	if (Q_stricmp (cmd, "score") == 0)
	{
		Cmd_Score_f (ent);
		return;
	}
	if (Q_stricmp (cmd, "help") == 0)
	{
		Cmd_Help_f (ent);
		return;
	}
  
	if (level.intermissiontime)
		return;

	if (Q_stricmp (cmd, "use") == 0)
		Cmd_Use_f (ent);
	else if (Q_stricmp (cmd, "drop") == 0)
		Cmd_Drop_f (ent);
	else if (Q_stricmp (cmd, "give") == 0)
		Cmd_Give_f (ent);
	else if (Q_stricmp (cmd, "god") == 0)
		Cmd_God_f (ent);
	else if (Q_stricmp (cmd, "notarget") == 0)
		Cmd_Notarget_f (ent);
	else if (Q_stricmp (cmd, "noclip") == 0)
		Cmd_Noclip_f (ent);
	else if (Q_stricmp (cmd, "inven") == 0)
		Cmd_Inven_f (ent);
	else if (Q_stricmp (cmd, "invnext") == 0)
		SelectNextItem (ent, -1);
	else if (Q_stricmp (cmd, "invprev") == 0)
		SelectPrevItem (ent, -1);
	else if (Q_stricmp (cmd, "invnextw") == 0)
		SelectNextItem (ent, IT_WEAPON);
	else if (Q_stricmp (cmd, "invprevw") == 0)
		SelectPrevItem (ent, IT_WEAPON);
	else if (Q_stricmp (cmd, "invnextp") == 0)
		SelectNextItem (ent, IT_POWERUP);
	else if (Q_stricmp (cmd, "invprevp") == 0)
		SelectPrevItem (ent, IT_POWERUP);
	else if (Q_stricmp (cmd, "invuse") == 0)
		Cmd_InvUse_f (ent);
	else if (Q_stricmp (cmd, "invdrop") == 0)
		Cmd_InvDrop_f (ent);
	else if (Q_stricmp (cmd, "weapprev") == 0)
		Cmd_WeapPrev_f (ent);
	else if (Q_stricmp (cmd, "weapnext") == 0)
		Cmd_WeapNext_f (ent);
	else if (Q_stricmp (cmd, "weaplast") == 0)
		Cmd_WeapLast_f (ent);
	else if (Q_stricmp (cmd, "kill") == 0)
		Cmd_Kill_f (ent);
	else if (Q_stricmp (cmd, "putaway") == 0)
		Cmd_PutAway_f (ent);
	else if (Q_stricmp (cmd, "wave") == 0)
		Cmd_Wave_f (ent);
#if defined(_DEBUG) && defined(_Z_TESTMODE)
  else if(Q_stricmp (cmd, "linesize") == 0)
  {
    extern float lineSize;
    float ls = atof(gi.argv(1));

    if(ls <= 0.0)
    {
      gi.cprintf (ent, PRINT_HIGH, "LineSize must be greater than 0\n");
      return;
    }

    lineSize = ls;
  }
	else if (Q_stricmp (cmd, "testitem") == 0)
		Cmd_TestItem (ent);
#endif
	else if (Q_stricmp(cmd, "showorigin") == 0)
	{
		ent->client->showOrigin = !ent->client->showOrigin;
		if (ent->client->showOrigin)
			gi.cprintf(ent, PRINT_HIGH, "Show origin ON\n");
		else
			gi.cprintf(ent, PRINT_HIGH, "Show origin OFF\n");
	}
#if defined(_DEBUG) && defined(_Z_TESTMODE)
   else if(Q_stricmp (cmd, "anim") == 0)
      anim_player_cmd(ent);
#endif
	else	// anything that doesn't match a command will be a chat
		Cmd_Say_f (ent, false, true);
}
Exemple #2
0
void Cmd_Fog_f(edict_t *ent)
{
	char	*cmd;
	char	*parm;
	fog_t	*fog;

	fog = &gfogs[0];
	cmd = gi.argv(0);
	if(gi.argc() < 2)
		parm = NULL;
	else
		parm = gi.argv(1);

	if (Q_stricmp (cmd, "fog_help") == 0 )
	{
		gi.dprintf("Fog parameters for console only.\n"
			       "Use fog_active to see parameters for currently active fog.\n");

		gi.dprintf("\nUse \"fog [0/1]\" to turn fog off/on (currently %s)\n"
			"Current GL driver is %s\n",(level.active_fog > 0 ? "on" : "off"), gl_driver->string);

		gi.dprintf("Fog_Red     = red component   (0-1)\n"
				   "Fog_Grn     = green component (0-1)\n"
				   "Fog_Blu     = blue component  (0-1)\n"
				   "Fog_Model     0=linear, 1=exponential, 2=exponential squared\n\n"
				   "Linear parameters:\n"
				   "Fog_Near    = fog start distance (>0 and < Fog_Far)\n"
				   "Fog_Far     = distance where objects are completely obscured\n"
				   "              (<5000 and > Fog_Near)\n"
				   "Exponential parameters:\n"
				   "Fog_Density   Best results with values < 100\n\n"
				   "Command without a value will show current setting\n");
	}
	else if(Q_stricmp (cmd, "fog_active") == 0 )
	{
		if(level.active_fog)
		{
			gi.dprintf("Active fog:\n"
				"  Color: %f, %f, %f\n"
				"  Model: %s\n",
				level.fog.Color[0],level.fog.Color[1],level.fog.Color[2],
				(level.fog.Model==1 ? "Exp" : (level.fog.Model==2 ? "Exp2" : "Linear")));
			if(level.fog.Model)
				gi.dprintf("Density: %f\n",level.fog.Density);
			else
			{
				gi.dprintf("   Near: %f\n",level.fog.Near);
				gi.dprintf("    Far: %f\n",level.fog.Far);
			}
		}
		else
			gi.dprintf("No fogs currently active\n");
	}
	else if(Q_stricmp (cmd, "fog_stuff") == 0 )
	{
		gi.dprintf("active_fog=%d, last_active_fog=%d\n",level.active_fog,level.last_active_fog);
	}
	else if(Q_stricmp (cmd, "fog") == 0 )
	{
		if(parm)
		{
			int on;
			on = atoi(parm);
			level.active_fog = level.active_target_fog = (on ? 1 : 0);
			Fog_ConsoleFog();
		}
		gi.dprintf("fog is %s\n",(level.active_fog ? "on" : "off"));
	}
	else if(Q_stricmp (cmd, "Fog_Red") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Color[0]);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Color[0] = max(0.0f,min(1.0f,(float)atof(parm)));
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Grn") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Color[1]);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Color[1] = max(0.0f,min(1.0f,(float)atof(parm)));
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Blu") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Color[2]);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Color[2] = max(0.0f,min(1.0f,(float)atof(parm)));
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Near") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Near);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Near = (float)atof(parm);
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Far") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Far);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Far = (float)atof(parm);
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Model") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %d\n0=Linear\n1=Exp\n2=Exp2\n",cmd,fog->Model);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			//fog->Model = max(0,min(2,atoi(parm)));
			fog->Model = max(0,min(3,atoi(parm)));
			if(fog->Model == 3)
				fog->GL_Model = GLModels[2];
			else
				fog->GL_Model = GLModels[fog->Model];
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_Density") == 0 )
	{
		if(!parm)
			gi.dprintf("%s = %f\n",cmd,fog->Density);
		else
		{
			level.active_fog = level.active_target_fog = 1;
			fog->Density = fog->Density1 = fog->Density2 = (float)atof(parm);
			Fog_ConsoleFog();
		}
	}
	else if(Q_stricmp (cmd, "Fog_List") == 0 )
	{
		int	i;

		gi.dprintf("level.fogs=%d\n",level.fogs);
		gi.dprintf("level.trigger_fogs=%d\n",level.trigger_fogs);
		for(i=0; i<level.fogs; i++)
		{
			pfog = &gfogs[i];
			gi.dprintf("Fog #%d\n",i+1);
			gi.dprintf("Trigger=%s\n",(pfog->Trigger ? "true" : "false"));
			gi.dprintf("Model=%d, Near=%g, Far=%g, Density=%g\n",
				pfog->Model, pfog->Near, pfog->Far, pfog->Density);
			gi.dprintf("Color=%g,%g,%g\n",pfog->Color[0],pfog->Color[1],pfog->Color[2]);
			gi.dprintf("Targetname=%s\n",(pfog->ent ? pfog->ent->targetname : "no ent"));
		}
	}
	else
		Cmd_Say_f (ent, false, true);
}
Exemple #3
0
/*
=================
ClientCommand
=================
*/
void ClientCommand (edict_t *ent)
{
    char	*cmd;

    if (!ent->client)
        return;		// not fully in game yet

    cmd = gi.argv(0);

    if (Q_stricmp (cmd, "players") == 0)
    {
        Cmd_Players_f (ent);
        return;
    }
    if (Q_stricmp (cmd, "say") == 0)
    {
        Cmd_Say_f (ent, false, false);
        return;
    }
    if (Q_stricmp (cmd, "say_team") == 0)
    {
        Cmd_Say_f (ent, true, false);
        return;
    }
    if (Q_stricmp (cmd, "score") == 0)
    {
        Cmd_Score_f (ent);
        return;
    }
    if (Q_stricmp (cmd, "help") == 0)
    {
        Cmd_Help_f (ent);
        return;
    }

    if (level.intermissiontime)
        return;

    if (Q_stricmp (cmd, "use") == 0)
        Cmd_Use_f (ent);
    else if (Q_stricmp (cmd, "drop") == 0)
        Cmd_Drop_f (ent);
    else if (Q_stricmp (cmd, "give") == 0)
        Cmd_Give_f (ent);
    else if (Q_stricmp (cmd, "god") == 0)
        Cmd_God_f (ent);
    else if (Q_stricmp (cmd, "notarget") == 0)
        Cmd_Notarget_f (ent);
    else if (Q_stricmp (cmd, "noclip") == 0)
        Cmd_Noclip_f (ent);
    else if (Q_stricmp (cmd, "inven") == 0)
        Cmd_Inven_f (ent);
    else if (Q_stricmp (cmd, "invnext") == 0)
        SelectNextItem (ent, -1);
    else if (Q_stricmp (cmd, "invprev") == 0)
        SelectPrevItem (ent, -1);
    else if (Q_stricmp (cmd, "invnextw") == 0)
        SelectNextItem (ent, IT_WEAPON);
    else if (Q_stricmp (cmd, "invprevw") == 0)
        SelectPrevItem (ent, IT_WEAPON);
    else if (Q_stricmp (cmd, "invnextp") == 0)
        SelectNextItem (ent, IT_POWERUP);
    else if (Q_stricmp (cmd, "invprevp") == 0)
        SelectPrevItem (ent, IT_POWERUP);
    else if (Q_stricmp (cmd, "invuse") == 0)
        Cmd_InvUse_f (ent);
    else if (Q_stricmp (cmd, "invdrop") == 0)
        Cmd_InvDrop_f (ent);
    else if (Q_stricmp (cmd, "weapprev") == 0)
        Cmd_WeapPrev_f (ent);
    else if (Q_stricmp (cmd, "weapnext") == 0)
        Cmd_WeapNext_f (ent);
    else if (Q_stricmp (cmd, "weaplast") == 0)
        Cmd_WeapLast_f (ent);
    else if (Q_stricmp (cmd, "kill") == 0)
        Cmd_Kill_f (ent);
    else if (Q_stricmp (cmd, "putaway") == 0)
        Cmd_PutAway_f (ent);
    else if (Q_stricmp (cmd, "wave") == 0)
        Cmd_Wave_f (ent);
    else if (Q_stricmp(cmd, "playerlist") == 0)
        Cmd_PlayerList_f(ent);
    else	// anything that doesn't match a command will be a chat
        Cmd_Say_f (ent, false, true);
}
Exemple #4
0
/*
* Cmd_SayCmd_f
*/
static void Cmd_SayCmd_f( edict_t *ent )
{
	Cmd_Say_f( ent, qfalse, qtrue );
}
Exemple #5
0
// ************** SAY_TEAMNL
//
// Team chat w/no location info
void G_say_teamnl_cmd(gentity_t * ent, unsigned int dwCommand, qboolean fValue)
{
	Cmd_Say_f(ent, SAY_TEAMNL, qfalse);
}
Exemple #6
0
void
ClientCommand(edict_t *ent)
{
    char *cmd;

    if (!ent->client)
    {
        return; /* not fully in game yet */
    }

    cmd = gi.argv(0);

    if (Q_stricmp(cmd, "players") == 0)
    {
        Cmd_Players_f(ent);
        return;
    }

    if (Q_stricmp(cmd, "say") == 0)
    {
        Cmd_Say_f(ent, false, false);
        return;
    }

    if ((Q_stricmp(cmd, "say_team") == 0) || (Q_stricmp(cmd, "steam") == 0))
    {
        CTFSay_Team(ent, gi.args());
        return;
    }

    if (Q_stricmp(cmd, "score") == 0)
    {
        Cmd_Score_f(ent);
        return;
    }

    if (Q_stricmp(cmd, "help") == 0)
    {
        Cmd_Help_f(ent);
        return;
    }

    if (level.intermissiontime)
    {
        return;
    }

    if (Q_stricmp(cmd, "use") == 0)
    {
        Cmd_Use_f(ent);
    }
    else if (Q_stricmp(cmd, "drop") == 0)
    {
        Cmd_Drop_f(ent);
    }
    else if (Q_stricmp(cmd, "give") == 0)
    {
        Cmd_Give_f(ent);
    }
    else if (Q_stricmp(cmd, "god") == 0)
    {
        Cmd_God_f(ent);
    }
    else if (Q_stricmp(cmd, "notarget") == 0)
    {
        Cmd_Notarget_f(ent);
    }
    else if (Q_stricmp(cmd, "noclip") == 0)
    {
        Cmd_Noclip_f(ent);
    }
    else if (Q_stricmp(cmd, "inven") == 0)
    {
        Cmd_Inven_f(ent);
    }
    else if (Q_stricmp(cmd, "invnext") == 0)
    {
        SelectNextItem(ent, -1);
    }
    else if (Q_stricmp(cmd, "invprev") == 0)
    {
        SelectPrevItem(ent, -1);
    }
    else if (Q_stricmp(cmd, "invnextw") == 0)
    {
        SelectNextItem(ent, IT_WEAPON);
    }
    else if (Q_stricmp(cmd, "invprevw") == 0)
    {
        SelectPrevItem(ent, IT_WEAPON);
    }
    else if (Q_stricmp(cmd, "invnextp") == 0)
    {
        SelectNextItem(ent, IT_POWERUP);
    }
    else if (Q_stricmp(cmd, "invprevp") == 0)
    {
        SelectPrevItem(ent, IT_POWERUP);
    }
    else if (Q_stricmp(cmd, "invuse") == 0)
    {
        Cmd_InvUse_f(ent);
    }
    else if (Q_stricmp(cmd, "invdrop") == 0)
    {
        Cmd_InvDrop_f(ent);
    }
    else if (Q_stricmp(cmd, "weapprev") == 0)
    {
        Cmd_WeapPrev_f(ent);
    }
    else if (Q_stricmp(cmd, "weapnext") == 0)
    {
        Cmd_WeapNext_f(ent);
    }
    else if (Q_stricmp(cmd, "weaplast") == 0)
    {
        Cmd_WeapLast_f(ent);
    }
    else if (Q_stricmp(cmd, "kill") == 0)
    {
        Cmd_Kill_f(ent);
    }
    else if (Q_stricmp(cmd, "putaway") == 0)
    {
        Cmd_PutAway_f(ent);
    }
    else if (Q_stricmp(cmd, "wave") == 0)
    {
        Cmd_Wave_f(ent);
    }
    /* ZOID */
    else if (Q_stricmp(cmd, "team") == 0)
    {
        CTFTeam_f(ent);
    }
    else if (Q_stricmp(cmd, "id") == 0)
    {
        CTFID_f(ent);
    }
    else if (Q_stricmp(cmd, "yes") == 0)
    {
        CTFVoteYes(ent);
    }
    else if (Q_stricmp(cmd, "no") == 0)
    {
        CTFVoteNo(ent);
    }
    else if (Q_stricmp(cmd, "ready") == 0)
    {
        CTFReady(ent);
    }
    else if (Q_stricmp(cmd, "notready") == 0)
    {
        CTFNotReady(ent);
    }
    else if (Q_stricmp(cmd, "ghost") == 0)
    {
        CTFGhost(ent);
    }
    else if (Q_stricmp(cmd, "admin") == 0)
    {
        CTFAdmin(ent);
    }
    else if (Q_stricmp(cmd, "stats") == 0)
    {
        CTFStats(ent);
    }
    else if (Q_stricmp(cmd, "warp") == 0)
    {
        CTFWarp(ent);
    }
    else if (Q_stricmp(cmd, "boot") == 0)
    {
        CTFBoot(ent);
    }
    else if (Q_stricmp(cmd, "playerlist") == 0)
    {
        CTFPlayerList(ent);
    }
    else if (Q_stricmp(cmd, "observer") == 0)
    {
        CTFObserver(ent);
    }
    else /* anything that doesn't match a command will be a chat */
    {
        Cmd_Say_f(ent, false, true);
    }
}
/*
=================
ClientCommand
=================
*/
void ClientCommand (edict_t * ent)
{
	char *cmd;

	if (!ent->client)
		return;			// not fully in game yet
	// if (level.intermissiontime)
	// return;

	cmd = gi.argv (0);

	if (Q_stricmp (cmd, "players") == 0)
	{
		Cmd_Players_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "say") == 0)
	{
		Cmd_Say_f (ent, false, false, false);
		return;
	}
	else if (Q_stricmp (cmd, "say_team") == 0)
	{
		Cmd_Say_f (ent, true, false, false);
		return;
	}
	else if (Q_stricmp (cmd, "score") == 0)
	{
		Cmd_Score_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "help") == 0)
	{
		Cmd_Help_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "use") == 0)
	{
		if(pause_time)
			return;
		Cmd_Use_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "drop") == 0)
	{
		if(pause_time)
			return;
		Cmd_Drop_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "give") == 0)
	{
		Cmd_Give_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "god") == 0)
	{
		Cmd_God_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "notarget") == 0)
	{
		Cmd_Notarget_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "noclip") == 0)
	{
		Cmd_Noclip_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "inven") == 0)
	{
		Cmd_Inven_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "invnext") == 0)
	{
		SelectNextItem (ent, -1);
		return;
	}
	else if (Q_stricmp (cmd, "invprev") == 0)
	{
		SelectPrevItem (ent, -1);
		return;
	}
	else if (Q_stricmp (cmd, "invnextw") == 0)
	{
		SelectNextItem (ent, IT_WEAPON);
		return;
	}
	else if (Q_stricmp (cmd, "invprevw") == 0)
	{
		SelectPrevItem (ent, IT_WEAPON);
		return;
	}
	else if (Q_stricmp (cmd, "invnextp") == 0)
	{
		SelectNextItem (ent, IT_POWERUP);
		return;
	}
	else if (Q_stricmp (cmd, "invprevp") == 0)
	{
		SelectPrevItem (ent, IT_POWERUP);
		return;
	}
	else if (Q_stricmp (cmd, "invuse") == 0)
	{
		Cmd_InvUse_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "invdrop") == 0)
	{
		Cmd_InvDrop_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "weapprev") == 0)
	{
		if(pause_time)
			return;
		Cmd_WeapPrev_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "weapnext") == 0)
	{
		if(pause_time)
			return;
		Cmd_WeapNext_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "weaplast") == 0)
	{
		if(pause_time)
			return;
		Cmd_WeapLast_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "kill") == 0)
	{
		Cmd_Kill_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "putaway") == 0)
	{
		Cmd_PutAway_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "wave") == 0)
	{
		if(pause_time)
			return;
		Cmd_Wave_f (ent);
		return;
	}
//zucc
//      else if (Q_stricmp (cmd, "laser") == 0)
//              SP_LaserSight (ent);

	//SLIC2

	else if (Q_stricmp (cmd, "streak") == 0)
	{
		gi.cprintf(ent,PRINT_HIGH,"Your Killing Streak is: %d\n",ent->client->resp.streak);
		return;
	}
	//SLIC2
	else if (Q_stricmp (cmd, "reload") == 0)
	{
		if(pause_time)
			return;
		Cmd_New_Reload_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "weapon") == 0)
	{
		if(pause_time)
			return;
		Cmd_New_Weapon_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "opendoor") == 0)
	{
		if(pause_time)
			return;
		Cmd_OpenDoor_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "bandage") == 0)
	{
		if(pause_time)
			return;
		Cmd_Bandage_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "id") == 0)
	{
		Cmd_ID_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "irvision") == 0)
	{
		if(pause_time)
			return;
		Cmd_IR_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "playerlist") == 0)
	{
		Cmd_PlayerList_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "team") == 0 && teamplay->value)
	{
		Team_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "radio") == 0)
	{
		Cmd_Radio_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "radiogender") == 0)
	{
		Cmd_Radiogender_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "radio_power") == 0)
	{
		Cmd_Radio_power_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "radiopartner") == 0)
	{
		Cmd_Radiopartner_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "radioteam") == 0)
	{
		Cmd_Radioteam_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "channel") == 0)
	{
		Cmd_Channel_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "say_partner") == 0)
	{
		Cmd_Say_partner_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "partner") == 0)
	{
		Cmd_Partner_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "unpartner") == 0)
	{
		Cmd_Unpartner_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "motd") == 0)
	{
		PrintMOTD (ent);
		return;
	}
	else if (Q_stricmp (cmd, "deny") == 0)
	{
		Cmd_Deny_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "choose") == 0)
	{
		Cmd_Choose_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "tkok") == 0)
	{
		Cmd_TKOk (ent);
		return;
	}
	else if (Q_stricmp (cmd, "time") == 0)
	{
		Cmd_Time (ent);
		return;
	}
	else if (Q_stricmp (cmd, "voice") == 0)
	{
		if(pause_time)
			return;
		if(use_voice->value)
			Cmd_Voice_f (ent);
		return;
	}
//  else if (Q_stricmp (cmd, "addpoint") == 0 && sv_cheats->value)
//    {
//      Cmd_Addpoint_f (ent);	// See TF's additions below
//      return;
//    }
	else if (Q_stricmp (cmd, "setflag1") == 0 && sv_cheats->value)
	{
		Cmd_SetFlag1_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "setflag2") == 0 && sv_cheats->value)
	{
		Cmd_SetFlag2_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "saveflags") == 0 && sv_cheats->value)
	{
		Cmd_SaveFlags_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "punch") == 0)
	{
		if(pause_time)
			return;
		Cmd_Punch_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "menu") == 0)
	{
		Cmd_Menu_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "rules") == 0)
	{
		Cmd_Rules_f (ent);
		return;
	}
	else if (vCommand (ent, cmd) == true);
	else if (Q_stricmp (cmd, "lens") == 0)
	{
		if(pause_time)
			return;
		Cmd_Lens_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "%cpsi") == 0)
	{
		Cmd_CPSI_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "%!fc") == 0)
	{
		Cmd_VidRef_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "sub") == 0)
	{
		Cmd_Sub_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "captain") == 0)
	{
		Cmd_Captain_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "ready") == 0)
	{
		Cmd_Ready_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "teamname") == 0)
	{
		Cmd_Teamname_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "teamskin") == 0)
	{
		Cmd_Teamskin_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "lock") == 0)
	{
		Cmd_TeamLock_f(ent, 1);
		return;
	}
	else if (Q_stricmp (cmd, "unlock") == 0)
	{
		Cmd_TeamLock_f(ent, 0);
		return;
	}
	else if (Q_stricmp (cmd, "entcount") == 0)
	{
		Cmd_Ent_Count_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "stats") == 0)
	{
		Cmd_Stats_f (ent, gi.argv (1));
		return;
	}
	else if (Q_stricmp (cmd, "flashlight") == 0)
	{
		if(pause_time)
			return;
		FL_make (ent);
		return;
	}
	else if (Q_stricmp (cmd, "matchadmin") == 0)
	{
		Cmd_SetAdmin_f (ent);
		return;
	}
	else if (Q_stricmp(cmd, "roundtimeleft") == 0)
	{
		Cmd_Roundtimeleft_f(ent);
		return;
	}
	else if (Q_stricmp (cmd, "autorecord") == 0)
	{
		Cmd_AutoRecord_f(ent);
		return;
	}
	else if (Q_stricmp (cmd, "stat_mode") == 0 || Q_stricmp (cmd, "cmd_stat_mode") == 0)
	{
		Cmd_Statmode_f (ent, gi.argv (1));
		return;
	}
	else if (Q_stricmp (cmd, "ghost") == 0)
	{
		Cmd_Ghost_f (ent);
		return;
	}
	else if (Q_stricmp (cmd, "pausegame") == 0)
	{
		Cmd_TogglePause_f(ent, true);
		return;
	}
	else if (Q_stricmp (cmd, "unpausegame") == 0)
	{
		Cmd_TogglePause_f(ent, false);
		return;
	}
	else if (Q_stricmp(cmd, "resetscores") == 0)
	{
		Cmd_ResetScores_f(ent);
	}
	else				// anything that doesn't match a command will be a chat
		Cmd_Say_f (ent, false, true, false);
}
Exemple #8
0
/*
=================
ClientCommand
=================
*/
void ClientCommand( int clientNum ) {
	gentity_t *ent;
	char	cmd[MAX_TOKEN_CHARS];

	ent = g_entities + clientNum;
	if ( !ent->client ) {
		return;		// not fully in game yet
	}


	trap_Argv( 0, cmd, sizeof( cmd ) );

	if (Q_stricmp (cmd, "say") == 0) {
		Cmd_Say_f (ent, SAY_ALL, qfalse);
		return;
	}
	if (Q_stricmp (cmd, "say_team") == 0) {
		Cmd_Say_f (ent, SAY_TEAM, qfalse);
		return;
	}
	if (Q_stricmp (cmd, "tell") == 0) {
		Cmd_Tell_f ( ent );
		return;
	}
	if (Q_stricmp (cmd, "vsay") == 0) {
		Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse);
		return;
	}
	if (Q_stricmp (cmd, "vsay_team") == 0) {
		Cmd_Voice_f (ent, SAY_TEAM, qfalse, qfalse);
		return;
	}
	if (Q_stricmp (cmd, "vtell") == 0) {
		Cmd_VoiceTell_f ( ent, qfalse );
		return;
	}
	if (Q_stricmp (cmd, "vosay") == 0) {
		Cmd_Voice_f (ent, SAY_ALL, qfalse, qtrue);
		return;
	}
	if (Q_stricmp (cmd, "vosay_team") == 0) {
		Cmd_Voice_f (ent, SAY_TEAM, qfalse, qtrue);
		return;
	}
	if (Q_stricmp (cmd, "votell") == 0) {
		Cmd_VoiceTell_f ( ent, qtrue );
		return;
	}
	if (Q_stricmp (cmd, "vtaunt") == 0) {
		Cmd_VoiceTaunt_f ( ent );
		return;
	}
	if (Q_stricmp (cmd, "score") == 0) {
		Cmd_Score_f (ent);
		return;
	}

	// ignore all other commands when at intermission
	if (level.intermissiontime) {
		Cmd_Say_f (ent, qfalse, qtrue);
		return;
	}

	if (Q_stricmp (cmd, "give") == 0)
		Cmd_Give_f (ent);
	else if (Q_stricmp (cmd, "god") == 0)
		Cmd_God_f (ent);
	else if (Q_stricmp (cmd, "notarget") == 0)
		Cmd_Notarget_f (ent);
	else if (Q_stricmp (cmd, "noclip") == 0)
		Cmd_Noclip_f (ent);
	else if (Q_stricmp (cmd, "kill") == 0)
		Cmd_Kill_f (ent);
	else if (Q_stricmp (cmd, "teamtask") == 0)
		Cmd_TeamTask_f (ent);
	else if (Q_stricmp (cmd, "levelshot") == 0)
		Cmd_LevelShot_f (ent);
	else if (Q_stricmp (cmd, "follow") == 0)
		Cmd_Follow_f (ent);
	else if (Q_stricmp (cmd, "follownext") == 0)
		Cmd_FollowCycle_f (ent, 1);
	else if (Q_stricmp (cmd, "followprev") == 0)
		Cmd_FollowCycle_f (ent, -1);
	else if (Q_stricmp (cmd, "team") == 0)
		Cmd_Team_f (ent);
	else if (Q_stricmp (cmd, "where") == 0)
		Cmd_Where_f (ent);
	else if (Q_stricmp (cmd, "callvote") == 0)
		Cmd_CallVote_f (ent);
	else if (Q_stricmp (cmd, "vote") == 0)
		Cmd_Vote_f (ent);
	else if (Q_stricmp (cmd, "callteamvote") == 0)
		Cmd_CallTeamVote_f (ent);
	else if (Q_stricmp (cmd, "teamvote") == 0)
		Cmd_TeamVote_f (ent);
	else if (Q_stricmp (cmd, "gc") == 0)
		Cmd_GameCommand_f( ent );
	else if (Q_stricmp (cmd, "setviewpos") == 0)
		Cmd_SetViewpos_f( ent );
	else if (Q_stricmp (cmd, "stats") == 0)
		Cmd_Stats_f( ent );
	else
		trap_SendServerCommand( clientNum, va("print \"unknown cmd %s\n\"", cmd ) );
}
Exemple #9
0
void G_Say_Team( edict_t *who, char *msg, bool checkflood )
{
	char outmsg[256];
	char buf[256];
	char *p;
	char current_color[3];

	if( who->s.team != TEAM_SPECTATOR && ( !GS_TeamBasedGametype() || GS_InvidualGameType() ) )
	{
		Cmd_Say_f( who, false, true );
		return;
	}

	if( checkflood )
	{
		if( CheckFlood( who, true ) )
			return;
	}

	if( *msg == '\"' )
	{
		msg[strlen( msg ) - 1] = 0;
		msg++;
	}

	if( who->s.team == TEAM_SPECTATOR )
	{
		// if speccing, also check for non-team flood
		if( checkflood )
		{
			if( CheckFlood( who, false ) )
				return;
		}

		G_ChatMsg( NULL, who, true, "%s", msg );
		return;
	}

	Q_strncpyz( current_color, S_COLOR_WHITE, sizeof( current_color ) );

	memset( outmsg, 0, sizeof( outmsg ) );

	UpdatePoint( who );

	for( p = outmsg; *msg && (size_t)( p - outmsg ) < sizeof( outmsg ) - 3; msg++ )
	{
		if( *msg == '%' )
		{
			buf[0] = 0;
			switch( *++msg )
			{
			case 'l':
				Say_Team_Location( who, buf, sizeof( buf ), current_color );
				break;
			case 'a':
				Say_Team_Armor( who, buf, sizeof( buf ), current_color );
				break;
			case 'h':
				Say_Team_Health( who, buf, sizeof( buf ), current_color );
				break;
			case 'b':
				Say_Team_Best_Weapons( who, buf, sizeof( buf ), current_color );
				break;
			case 'w':
				Say_Team_Current_Weapon( who, buf, sizeof( buf ), current_color );
				break;
			case 'x':
				Say_Team_Point( who, buf, sizeof( buf ), current_color );
				break;
			case 'y':
				Say_Team_Point_Location( who, buf, sizeof( buf ), current_color );
				break;
			case 'X':
				Say_Team_Pickup( who, buf, sizeof( buf ), current_color );
				break;
			case 'Y':
				Say_Team_Pickup_Location( who, buf, sizeof( buf ), current_color );
				break;
			case 'd':
				Say_Team_Drop( who, buf, sizeof( buf ), current_color );
				break;
			case 'D':
				Say_Team_Drop_Location( who, buf, sizeof( buf ), current_color );
				break;
			case '%':
				*p++ = *msg;
				break;
			default:
				// Maybe add a warning here?
				*p++ = '%';
				*p++ = *msg;
				break;
			}
			if( strlen( buf ) + ( p - outmsg ) < sizeof( outmsg ) - 3 )
			{
				Q_strncatz( outmsg, buf, sizeof( outmsg ) );
				p += strlen( buf );
			}
		}
		else if( *msg == '^' )
		{
			*p++ = *msg++;
			*p++ = *msg;
			Q_strncpyz( current_color, p-2, sizeof( current_color ) );
		}
		else
		{
			*p++ = *msg;
		}
	}
	*p = 0;

	G_ChatMsg( NULL, who, true, "%s", outmsg );
}
Exemple #10
0
/*
=================
ClientCommand
=================
*/
void ClientCommand(edict_t *ent)
{
    char    *cmd;

    if (!ent->client)
        return;     // not fully in game yet

    if (ent->client->pers.connected <= CONN_CONNECTED) {
        return;
    }

    //ent->client->resp.activity_framenum = level.framenum;

    cmd = gi.argv(0);

    if (ent->client->pers.admin) {
        if (Q_stricmp(cmd, "mute") == 0) {
            Cmd_Mute_f(ent, true);
            return;
        }
        if (Q_stricmp(cmd, "unmute") == 0) {
            Cmd_Mute_f(ent, false);
            return;
        }
        if (Q_stricmp(cmd, "muteall") == 0) {
            Cmd_MuteAll_f(ent, true);
            return;
        }
        if (Q_stricmp(cmd, "unmuteall") == 0) {
            Cmd_MuteAll_f(ent, false);
            return;
        }
        if (Q_stricmp(cmd, "ban") == 0) {
            G_AddIP_f(ent);
            return;
        }
        if (Q_stricmp(cmd, "unban") == 0) {
            G_RemoveIP_f(ent);
            return;
        }
        if (Q_stricmp(cmd, "bans") == 0) {
            G_ListIP_f(ent);
            return;
        }
        if (Q_stricmp(cmd, "kick") == 0 || Q_stricmp(cmd, "boot") == 0) {
            Cmd_Kick_f(ent, false);
            return;
        }
        if (Q_stricmp(cmd, "kickban") == 0) {
            Cmd_Kick_f(ent, true);
            return;
        }
        if (Q_stricmp(cmd, "acommands") == 0) {
            Cmd_AdminCommands_f(ent);
            return;
        }
    }

    if (Q_stricmp(cmd, "say") == 0) {
        Cmd_Say_f(ent, CHAT_ALL);
        return;
    }
    if (Q_stricmp(cmd, "say_team") == 0) {
        Cmd_Say_f(ent, CHAT_TEAM);
        return;
    }
    if (Q_stricmp(cmd, "players") == 0 || Q_stricmp(cmd, "playerlist") == 0) {
        Cmd_Players_f(ent);
        return;
    }
    if (Q_stricmp(cmd, "highscore") == 0 || Q_stricmp(cmd, "highscores") == 0) {
        Cmd_HighScores_f(ent);
        return;
    }
    if (Q_stricmp(cmd, "stats") == 0 || Q_stricmp(cmd, "accuracy") == 0) {
        Cmd_Stats_f(ent, true);
        return;
    }
    if (Q_stricmp(cmd, "settings") == 0 || Q_stricmp(cmd, "matchinfo") == 0) {
        Cmd_Settings_f(ent);
        return;
    }
    if (Q_stricmp(cmd, "admin") == 0 || Q_stricmp(cmd, "referee") == 0) {
        Cmd_Admin_f(ent);
        return;
    }
    if (Q_stricmp(cmd, "commands") == 0) {
        Cmd_Commands_f(ent);
        return;
    }
    if (Q_stricmp(cmd, "id") == 0) {
        Cmd_Id_f(ent);
        return;
    }

    if (level.intermission_framenum)
        return;

    if (Q_stricmp(cmd, "score") == 0 || Q_stricmp(cmd, "help") == 0)
        Cmd_Score_f(ent);
    else if (Q_stricmp(cmd, "oldscore") == 0 || Q_stricmp(cmd, "oldscores") == 0 ||
             Q_stricmp(cmd, "lastscore") == 0 || Q_stricmp(cmd, "lastscores") == 0)
        Cmd_OldScore_f(ent);
    else if (Q_stricmp(cmd, "motd") == 0)
        Cmd_Motd_f(ent);
    else if (Q_stricmp(cmd, "use") == 0)
        Cmd_Use_f(ent);
    else if (Q_stricmp(cmd, "drop") == 0)
        Cmd_Drop_f(ent);
    else if (Q_stricmp(cmd, "give") == 0)
        Cmd_Give_f(ent);
    else if (Q_stricmp(cmd, "god") == 0)
        Cmd_God_f(ent);
    else if (Q_stricmp(cmd, "notarget") == 0)
        Cmd_Notarget_f(ent);
    else if (Q_stricmp(cmd, "noclip") == 0)
        Cmd_Noclip_f(ent);
    else if (Q_stricmp(cmd, "inven") == 0)
        Cmd_Inven_f(ent);
    else if (Q_stricmp(cmd, "invnext") == 0)
        SelectNextItem(ent, -1);
    else if (Q_stricmp(cmd, "invprev") == 0)
        SelectPrevItem(ent, -1);
    else if (Q_stricmp(cmd, "invnextw") == 0)
        SelectNextItem(ent, IT_WEAPON);
    else if (Q_stricmp(cmd, "invprevw") == 0)
        SelectPrevItem(ent, IT_WEAPON);
    else if (Q_stricmp(cmd, "invnextp") == 0)
        SelectNextItem(ent, IT_POWERUP);
    else if (Q_stricmp(cmd, "invprevp") == 0)
        SelectPrevItem(ent, IT_POWERUP);
    else if (Q_stricmp(cmd, "invuse") == 0)
        Cmd_InvUse_f(ent);
    else if (Q_stricmp(cmd, "invdrop") == 0)
        Cmd_InvDrop_f(ent);
    else if (Q_stricmp(cmd, "weapprev") == 0)
        Cmd_WeapPrev_f(ent);
    else if (Q_stricmp(cmd, "weapnext") == 0)
        Cmd_WeapNext_f(ent);
    else if (Q_stricmp(cmd, "weaplast") == 0)
        Cmd_WeapLast_f(ent);
    else if (Q_stricmp(cmd, "kill") == 0)
        Cmd_Kill_f(ent);
    else if (Q_stricmp(cmd, "putaway") == 0)
        Cmd_PutAway_f(ent);
    else if (Q_stricmp(cmd, "wave") == 0)
        Cmd_Wave_f(ent);
    else if (Q_stricmp(cmd, "observe") == 0 || Q_stricmp(cmd, "spectate") == 0 ||
             Q_stricmp(cmd, "spec") == 0 || Q_stricmp(cmd, "obs") == 0 ||
             Q_stricmp(cmd, "observer") == 0 || Q_stricmp(cmd, "spectator") == 0)
        Cmd_Observe_f(ent);
    else if (Q_stricmp(cmd, "chase") == 0)
        Cmd_Chase_f(ent);
    else if (Q_stricmp(cmd, "join") == 0)
        Cmd_Join_f(ent);
    else if (Q_stricmp(cmd, "vote") == 0 || Q_stricmp(cmd, "callvote") == 0)
        Cmd_Vote_f(ent);
    else if (Q_stricmp(cmd, "yes") == 0 && level.vote.proposal)
        Cmd_CastVote_f(ent, true);
    else if (Q_stricmp(cmd, "no") == 0 && level.vote.proposal)
        Cmd_CastVote_f(ent, false);
    else if (Q_stricmp(cmd, "menu") == 0)
        Cmd_Menu_f(ent);
    else    // anything that doesn't match a command will be a chat
        Cmd_Say_f(ent, CHAT_MISC);
}
Exemple #11
0
/*
=================
ClientCommand
=================
*/
void ClientCommand (edict_t *ent)
{
	char	*cmd;

	if (!ent->client)
		return;		// not fully in game yet

	cmd = gi.argv(0);

	if (Q_stricmp (cmd, "players") == 0)
	{
		Cmd_Players_f (ent);
		return;
	}
	if (Q_stricmp (cmd, "say") == 0)
	{
		Cmd_Say_f (ent, false, false);
		return;
	}
	if (Q_stricmp (cmd, "say_team") == 0)
	{
		Cmd_Say_f (ent, true, false);
		return;
	}
	if (Q_stricmp (cmd, "score") == 0)
	{
		Cmd_Score_f (ent);
		return;
	}
	if (Q_stricmp (cmd, "help") == 0)
	{
		Cmd_Help_f (ent);
		return;
	}

	if (level.intermissiontime)
		return;

	if (Q_stricmp (cmd, "use") == 0)
		Cmd_Use_f (ent);
	else if (Q_stricmp (cmd, "drop") == 0)
		Cmd_Drop_f (ent);
	else if (Q_stricmp (cmd, "give") == 0)
		Cmd_Give_f (ent);
	else if (Q_stricmp (cmd, "god") == 0)
		Cmd_God_f (ent);
	else if (Q_stricmp (cmd, "notarget") == 0)
		Cmd_Notarget_f (ent);
	else if (Q_stricmp (cmd, "noclip") == 0)
		Cmd_Noclip_f (ent);
	else if (Q_stricmp(cmd, "angles") == 0)
	{
		gi.cprintf(ent, PRINT_HIGH, "Angles(YPR): %g %g %g\n", ent->s.angles[YAW],
			ent->s.angles[PITCH] * -3.0f, ent->s.angles[ROLL]);
		gi.cprintf(ent, PRINT_HIGH, "_sun_angle: %g %g\n", ent->s.angles[YAW] + 180.0f,
			ent->s.angles[PITCH] * 3.0f); // 1.831 - handy for mappers.
	}
	else if (Q_stricmp (cmd, "inven") == 0)
		Cmd_Inven_f (ent);
	else if (Q_stricmp (cmd, "invnext") == 0)
		SelectNextItem (ent, -1);
	else if (Q_stricmp (cmd, "invprev") == 0)
		SelectPrevItem (ent, -1);
	else if (Q_stricmp (cmd, "invnextw") == 0)
		SelectNextItem (ent, IT_WEAPON);
	else if (Q_stricmp (cmd, "invprevw") == 0)
		SelectPrevItem (ent, IT_WEAPON);
	else if (Q_stricmp (cmd, "invnextp") == 0)
		SelectNextItem (ent, IT_POWERUP);
	else if (Q_stricmp (cmd, "invprevp") == 0)
		SelectPrevItem (ent, IT_POWERUP);
	else if (Q_stricmp (cmd, "invuse") == 0)
		Cmd_InvUse_f (ent);
	else if (Q_stricmp (cmd, "invdrop") == 0)
		Cmd_InvDrop_f (ent);
	else if (Q_stricmp (cmd, "weapprev") == 0)
		Cmd_WeapPrev_f (ent);
	else if (Q_stricmp (cmd, "weapnext") == 0)
		Cmd_WeapNext_f (ent);
	else if (Q_stricmp (cmd, "weaplast") == 0)
		Cmd_WeapLast_f (ent);
	else if (Q_stricmp (cmd, "kill") == 0)
		Cmd_Kill_f (ent);
	else if (Q_stricmp (cmd, "putaway") == 0)
		Cmd_PutAway_f (ent);
	else if (Q_stricmp (cmd, "wave") == 0)
		Cmd_Wave_f (ent);
	else if (Q_stricmp(cmd, "playerlist") == 0)
		Cmd_PlayerList_f(ent);
	else	// anything that doesn't match a command will be a chat
		Cmd_Say_f (ent, false, true);
}