2013-05-01 08:43:49 +00:00
|
|
|
/* =======================================================================
|
|
|
|
*
|
|
|
|
* Game command processing.
|
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*/
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
#include "header/local.h"
|
|
|
|
#include "monster/misc/player.h"
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2014-11-30 16:50:34 +00:00
|
|
|
static char *
|
|
|
|
ClientTeam(edict_t *ent, char* value)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *p;
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
value[0] = 0;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return value;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!ent->client)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return value;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
strcpy(value, Info_ValueForKey(ent->client->pers.userinfo, "skin"));
|
2009-03-12 20:03:41 +00:00
|
|
|
p = strchr(value, '/');
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!p)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return value;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if ((int)(dmflags->value) & DF_MODELTEAMS)
|
|
|
|
{
|
|
|
|
*p = 0;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ++p;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
qboolean
|
|
|
|
OnSameTeam(edict_t *ent1, edict_t *ent2)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char ent1Team[512];
|
|
|
|
char ent2Team[512];
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent1 || !ent2)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return false;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2014-11-30 16:50:34 +00:00
|
|
|
ClientTeam(ent1, ent1Team);
|
|
|
|
ClientTeam(ent2, ent2Team);
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2014-11-30 16:50:34 +00:00
|
|
|
if (ent1Team[0] != '\0' && strcmp(ent1Team, ent2Team) == 0)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return true;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
SelectNextItem(edict_t *ent, int itflags)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
|
|
|
int i, index;
|
|
|
|
gitem_t *it;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (cl->chase_target)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
ChaseNext(ent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* scan for the next valid one */
|
|
|
|
for (i = 1; i <= MAX_ITEMS; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
index = (cl->pers.selected_item + i) % MAX_ITEMS;
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!cl->pers.inventory[index])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
it = &itemlist[index];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!(it->flags & itflags))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
cl->pers.selected_item = index;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->pers.selected_item = -1;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
SelectPrevItem(edict_t *ent, int itflags)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
|
|
|
int i, index;
|
|
|
|
gitem_t *it;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (cl->chase_target)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
ChasePrev(ent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* scan for the next valid one */
|
|
|
|
for (i = 1; i <= MAX_ITEMS; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
index = (cl->pers.selected_item + MAX_ITEMS - i) % MAX_ITEMS;
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!cl->pers.inventory[index])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
it = &itemlist[index];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!(it->flags & itflags))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
cl->pers.selected_item = index;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->pers.selected_item = -1;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
ValidateSelectedItem(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (cl->pers.inventory[cl->pers.selected_item])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
|
|
|
return; /* valid */
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
SelectNextItem(ent, -1);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* ================================================================================= */
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
/*
|
2013-05-01 08:43:49 +00:00
|
|
|
* Give items to a client
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Cmd_Give_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *name;
|
|
|
|
gitem_t *it;
|
|
|
|
int index;
|
|
|
|
int i;
|
|
|
|
qboolean give_all;
|
|
|
|
edict_t *it_ent;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-31 09:18:35 +00:00
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH,
|
|
|
|
"You must run the server with '+set cheats 1' to enable this command.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
name = gi.args();
|
|
|
|
|
|
|
|
if (Q_stricmp(name, "all") == 0)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
give_all = true;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
give_all = false;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (give_all || (Q_stricmp(gi.argv(1), "health") == 0))
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
if (gi.argc() == 3)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2019-04-27 17:19:03 +00:00
|
|
|
ent->health = atoi(gi.argv(2));
|
|
|
|
ent->health = ent->health < 1 ? 1 : ent->health;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->health = ent->max_health;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!give_all)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (give_all || (Q_stricmp(name, "weapons") == 0))
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
for (i = 0; i < game.num_items; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
it = itemlist + i;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->pickup)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!(it->flags & IT_WEAPON))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->client->pers.inventory[i] += 1;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!give_all)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (give_all || (Q_stricmp(name, "ammo") == 0))
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
for (i = 0; i < game.num_items; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
it = itemlist + i;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->pickup)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!(it->flags & IT_AMMO))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Add_Ammo(ent, it, 1000);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!give_all)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (give_all || (Q_stricmp(name, "armor") == 0))
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gitem_armor_t *info;
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
it = FindItem("Jacket Armor");
|
|
|
|
ent->client->pers.inventory[ITEM_INDEX(it)] = 0;
|
|
|
|
|
|
|
|
it = FindItem("Combat Armor");
|
|
|
|
ent->client->pers.inventory[ITEM_INDEX(it)] = 0;
|
|
|
|
|
|
|
|
it = FindItem("Body Armor");
|
|
|
|
info = (gitem_armor_t *)it->info;
|
|
|
|
ent->client->pers.inventory[ITEM_INDEX(it)] = info->max_count;
|
|
|
|
|
|
|
|
if (!give_all)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (give_all || (Q_stricmp(name, "Power Shield") == 0))
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
it = FindItem("Power Shield");
|
|
|
|
it_ent = G_Spawn();
|
|
|
|
it_ent->classname = it->classname;
|
2013-05-01 08:43:49 +00:00
|
|
|
SpawnItem(it_ent, it);
|
|
|
|
Touch_Item(it_ent, ent, NULL, NULL);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (it_ent->inuse)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
G_FreeEdict(it_ent);
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (!give_all)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (give_all)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
for (i = 0; i < game.num_items; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
it = itemlist + i;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->pickup)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it->flags & IT_NOT_GIVEABLE)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it->flags & (IT_ARMOR | IT_WEAPON | IT_AMMO))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->client->pers.inventory[i] = 1;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
it = FindItem(name);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it)
|
|
|
|
{
|
|
|
|
name = gi.argv(1);
|
2013-05-01 08:43:49 +00:00
|
|
|
it = FindItem(name);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "unknown item\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!it->pickup)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "non-pickup item\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (it->flags & IT_NOT_GIVEABLE)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.dprintf("item cannot be given\n");
|
|
|
|
return;
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
index = ITEM_INDEX(it);
|
|
|
|
|
|
|
|
if (it->flags & IT_AMMO)
|
|
|
|
{
|
|
|
|
if (gi.argc() == 3)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->client->pers.inventory[index] = atoi(gi.argv(2));
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->client->pers.inventory[index] += it->quantity;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
it_ent = G_Spawn();
|
|
|
|
it_ent->classname = it->classname;
|
2013-05-01 08:43:49 +00:00
|
|
|
SpawnItem(it_ent, it);
|
|
|
|
|
|
|
|
/* since some items don't actually spawn when you say to .. */
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it_ent->inuse)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Touch_Item(it_ent, ent, NULL, NULL);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (it_ent->inuse)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
G_FreeEdict(it_ent);
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-05-01 08:43:49 +00:00
|
|
|
* Sets client to godmode
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Cmd_God_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *msg;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-31 09:18:35 +00:00
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH,
|
|
|
|
"You must run the server with '+set cheats 1' to enable this command.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->flags ^= FL_GODMODE;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (!(ent->flags & FL_GODMODE))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
msg = "godmode OFF\n";
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
msg = "godmode ON\n";
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, msg);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-05-01 08:43:49 +00:00
|
|
|
* Sets client to notarget
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Cmd_Notarget_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *msg;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-31 09:18:35 +00:00
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH,
|
|
|
|
"You must run the server with '+set cheats 1' to enable this command.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->flags ^= FL_NOTARGET;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (!(ent->flags & FL_NOTARGET))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
msg = "notarget OFF\n";
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
msg = "notarget ON\n";
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, msg);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Noclip_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *msg;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-31 09:18:35 +00:00
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH,
|
|
|
|
"You must run the server with '+set cheats 1' to enable this command.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ent->movetype == MOVETYPE_NOCLIP)
|
|
|
|
{
|
|
|
|
ent->movetype = MOVETYPE_WALK;
|
|
|
|
msg = "noclip OFF\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ent->movetype = MOVETYPE_NOCLIP;
|
|
|
|
msg = "noclip ON\n";
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, msg);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-05-01 08:43:49 +00:00
|
|
|
* Use an inventory item
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Cmd_Use_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int index;
|
|
|
|
gitem_t *it;
|
|
|
|
char *s;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
s = gi.args();
|
2013-05-01 08:43:49 +00:00
|
|
|
it = FindItem(s);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "unknown item: %s\n", s);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Item is not usable.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
index = ITEM_INDEX(it);
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!ent->client->pers.inventory[index])
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
it->use(ent, it);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2013-05-01 08:43:49 +00:00
|
|
|
* Drop an inventory item
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Cmd_Drop_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int index;
|
|
|
|
gitem_t *it;
|
|
|
|
char *s;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
s = gi.args();
|
2013-05-01 08:43:49 +00:00
|
|
|
it = FindItem(s);
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "unknown item: %s\n", s);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->drop)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Item is not dropable.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
index = ITEM_INDEX(it);
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!ent->client->pers.inventory[index])
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", s);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
it->drop(ent, it);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 12:14:02 +00:00
|
|
|
void
|
|
|
|
Cmd_Score_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->client->showinventory = false;
|
|
|
|
ent->client->showhelp = false;
|
|
|
|
|
|
|
|
if (!deathmatch->value && !coop->value)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ent->client->showscores)
|
|
|
|
{
|
|
|
|
ent->client->showscores = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->client->showscores = true;
|
|
|
|
DeathmatchScoreboardMessage(ent, ent->enemy);
|
|
|
|
gi.unicast(ent, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Cmd_Help_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this is for backwards compatability */
|
|
|
|
if (deathmatch->value)
|
|
|
|
{
|
|
|
|
Cmd_Score_f(ent);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->client->showinventory = false;
|
|
|
|
ent->client->showscores = false;
|
|
|
|
|
|
|
|
if (ent->client->showhelp)
|
|
|
|
{
|
|
|
|
ent->client->showhelp = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ent->client->showhelp = true;
|
|
|
|
ent->client->pers.helpchanged = 0;
|
|
|
|
HelpComputerMessage(ent);
|
|
|
|
gi.unicast(ent, true);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Inven_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
cl->showscores = false;
|
|
|
|
cl->showhelp = false;
|
|
|
|
|
|
|
|
if (cl->showinventory)
|
|
|
|
{
|
|
|
|
cl->showinventory = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->showinventory = true;
|
2014-02-22 12:14:02 +00:00
|
|
|
|
|
|
|
InventoryMessage(ent);
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.unicast(ent, true);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_InvUse_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gitem_t *it;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
ValidateSelectedItem(ent);
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (ent->client->pers.selected_item == -1)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "No item to use.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
it = &itemlist[ent->client->pers.selected_item];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Item is not usable.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
it->use(ent, it);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_WeapPrev_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
|
|
|
int i, index;
|
|
|
|
gitem_t *it;
|
|
|
|
int selected_weapon;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (!cl->pers.weapon)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
selected_weapon = ITEM_INDEX(cl->pers.weapon);
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* scan for the next valid one */
|
|
|
|
for (i = 1; i <= MAX_ITEMS; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
/* prevent scrolling through ALL weapons */
|
|
|
|
index = (selected_weapon + MAX_ITEMS - i) % MAX_ITEMS;
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!cl->pers.inventory[index])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
it = &itemlist[index];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(it->flags & IT_WEAPON))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
it->use(ent, it);
|
|
|
|
|
|
|
|
/* prevent scrolling through ALL weapons */
|
2009-03-12 20:03:41 +00:00
|
|
|
if (cl->newweapon == it)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_WeapNext_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
|
|
|
int i, index;
|
|
|
|
gitem_t *it;
|
|
|
|
int selected_weapon;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (!cl->pers.weapon)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
selected_weapon = ITEM_INDEX(cl->pers.weapon);
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* scan for the next valid one */
|
|
|
|
for (i = 1; i <= MAX_ITEMS; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
/* prevent scrolling through ALL weapons */
|
|
|
|
index = (selected_weapon + i) % MAX_ITEMS;
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!cl->pers.inventory[index])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
it = &itemlist[index];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(it->flags & IT_WEAPON))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
it->use(ent, it);
|
|
|
|
|
|
|
|
/* prevent scrolling through ALL weapons */
|
2009-03-12 20:03:41 +00:00
|
|
|
if (cl->newweapon == it)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_WeapLast_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gclient_t *cl;
|
|
|
|
int index;
|
|
|
|
gitem_t *it;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (!cl->pers.weapon || !cl->pers.lastweapon)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
index = ITEM_INDEX(cl->pers.lastweapon);
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!cl->pers.inventory[index])
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
it = &itemlist[index];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->use)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(it->flags & IT_WEAPON))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
it->use(ent, it);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_InvDrop_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gitem_t *it;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
ValidateSelectedItem(ent);
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (ent->client->pers.selected_item == -1)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "No item to drop.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
it = &itemlist[ent->client->pers.selected_item];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!it->drop)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Item is not dropable.\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
it->drop(ent, it);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Kill_f(edict_t *ent)
|
2014-02-22 12:20:22 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if ((level.time - ent->client->respawn_time) < 5)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->flags &= ~FL_GODMODE;
|
|
|
|
ent->health = 0;
|
|
|
|
meansOfDeath = MOD_SUICIDE;
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* make sure no trackers are still hurting us. */
|
|
|
|
if (ent->client->tracker_pain_framenum)
|
|
|
|
{
|
|
|
|
RemoveAttackingPainDaemons(ent);
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (ent->client->owned_sphere)
|
|
|
|
{
|
|
|
|
G_FreeEdict(ent->client->owned_sphere);
|
|
|
|
ent->client->owned_sphere = NULL;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
player_die(ent, ent, ent, 100000, vec3_origin);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_PutAway_f(edict_t *ent)
|
2014-02-22 12:20:22 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
ent->client->showscores = false;
|
|
|
|
ent->client->showhelp = false;
|
|
|
|
ent->client->showinventory = false;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
int
|
|
|
|
PlayerSort(void const *a, void const *b)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int anum, bnum;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!a || !b)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
anum = *(int *)a;
|
|
|
|
bnum = *(int *)b;
|
|
|
|
|
|
|
|
anum = game.clients[anum].ps.stats[STAT_FRAGS];
|
|
|
|
bnum = game.clients[bnum].ps.stats[STAT_FRAGS];
|
|
|
|
|
|
|
|
if (anum < bnum)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return -1;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (anum > bnum)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return 1;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Players_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int i;
|
|
|
|
int count;
|
|
|
|
char small[64];
|
|
|
|
char large[1280];
|
|
|
|
int index[256];
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
count = 0;
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
for (i = 0; i < maxclients->value; i++)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
if (game.clients[i].pers.connected)
|
|
|
|
{
|
|
|
|
index[count] = i;
|
|
|
|
count++;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* sort by frags */
|
|
|
|
qsort(index, count, sizeof(index[0]), PlayerSort);
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* print information */
|
2009-03-12 20:03:41 +00:00
|
|
|
large[0] = 0;
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
for (i = 0; i < count; i++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Com_sprintf(small, sizeof(small), "%3i %s\n",
|
|
|
|
game.clients[index[i]].ps.stats[STAT_FRAGS],
|
|
|
|
game.clients[index[i]].pers.netname);
|
|
|
|
|
|
|
|
if (strlen(small) + strlen(large) > sizeof(large) - 100)
|
2014-02-22 12:20:22 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
/* can't print all of them in one packet */
|
|
|
|
strcat(large, "...\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
strcat(large, small);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "%s\n%i players\n", large, count);
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Wave_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int i;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
i = atoi(gi.argv(1));
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* can't wave when ducked */
|
2009-03-12 20:03:41 +00:00
|
|
|
if (ent->client->ps.pmove.pm_flags & PMF_DUCKED)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (ent->client->anim_priority > ANIM_WAVE)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
ent->client->anim_priority = ANIM_WAVE;
|
|
|
|
|
|
|
|
switch (i)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
case 0:
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "flipoff\n");
|
|
|
|
ent->s.frame = FRAME_flip01 - 1;
|
|
|
|
ent->client->anim_end = FRAME_flip12;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "salute\n");
|
|
|
|
ent->s.frame = FRAME_salute01 - 1;
|
|
|
|
ent->client->anim_end = FRAME_salute11;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "taunt\n");
|
|
|
|
ent->s.frame = FRAME_taunt01 - 1;
|
|
|
|
ent->client->anim_end = FRAME_taunt17;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "wave\n");
|
|
|
|
ent->s.frame = FRAME_wave01 - 1;
|
|
|
|
ent->client->anim_end = FRAME_wave11;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
default:
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "point\n");
|
|
|
|
ent->s.frame = FRAME_point01 - 1;
|
|
|
|
ent->client->anim_end = FRAME_point12;
|
|
|
|
break;
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Say_f(edict_t *ent, qboolean team, qboolean arg0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int i, j;
|
|
|
|
edict_t *other;
|
|
|
|
char *p;
|
|
|
|
char text[2048];
|
2009-03-12 20:03:41 +00:00
|
|
|
gclient_t *cl;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if ((gi.argc() < 2) && !arg0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (!((int)(dmflags->value) & (DF_MODELTEAMS | DF_SKINTEAMS)))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
team = false;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (team)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
|
|
|
Com_sprintf(text, sizeof(text), "(%s): ", ent->client->pers.netname);
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
|
|
|
Com_sprintf(text, sizeof(text), "%s: ", ent->client->pers.netname);
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
if (arg0)
|
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
strcat(text, gi.argv(0));
|
|
|
|
strcat(text, " ");
|
|
|
|
strcat(text, gi.args());
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p = gi.args();
|
|
|
|
|
|
|
|
if (*p == '"')
|
|
|
|
{
|
|
|
|
p++;
|
2013-05-01 08:43:49 +00:00
|
|
|
p[strlen(p) - 1] = 0;
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
strcat(text, p);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* don't let text be too long for malicious reasons */
|
2009-03-12 20:03:41 +00:00
|
|
|
if (strlen(text) > 150)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
text[150] = 0;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
strcat(text, "\n");
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (flood_msgs->value)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
cl = ent->client;
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (level.time < cl->flood_locktill)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "You can't talk for %d more seconds\n",
|
2013-05-01 08:43:49 +00:00
|
|
|
(int)(cl->flood_locktill - level.time));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = cl->flood_whenhead - flood_msgs->value + 1;
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
{
|
|
|
|
i = (sizeof(cl->flood_when) / sizeof(cl->flood_when[0])) + i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cl->flood_when[i] &&
|
|
|
|
(level.time - cl->flood_when[i] < flood_persecond->value))
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
cl->flood_locktill = level.time + flood_waitdelay->value;
|
2013-05-01 08:43:49 +00:00
|
|
|
gi.cprintf(ent, PRINT_CHAT,
|
|
|
|
"Flood protection: You can't talk for %d seconds.\n",
|
|
|
|
(int)flood_waitdelay->value);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl->flood_whenhead = (cl->flood_whenhead + 1) % (sizeof(cl->flood_when) /
|
|
|
|
sizeof(cl->flood_when[0]));
|
2009-03-12 20:03:41 +00:00
|
|
|
cl->flood_when[cl->flood_whenhead] = level.time;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dedicated->value)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
gi.cprintf(NULL, PRINT_CHAT, "%s", text);
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
for (j = 1; j <= game.maxclients; j++)
|
|
|
|
{
|
|
|
|
other = &g_edicts[j];
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!other->inuse)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!other->client)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (team)
|
|
|
|
{
|
|
|
|
if (!OnSameTeam(ent, other))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
gi.cprintf(other, PRINT_CHAT, "%s", text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_Ent_Count_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
int x;
|
|
|
|
edict_t *e;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
x = 0;
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
for (e = g_edicts; e < &g_edicts[globals.num_edicts]; e++)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
if (e->inuse)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
x++;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gi.dprintf("%d entites active\n", x);
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
Cmd_PlayerList_f(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2019-09-23 19:44:35 +00:00
|
|
|
int i, text_len;
|
2009-03-12 20:03:41 +00:00
|
|
|
char st[80];
|
|
|
|
char text[1400];
|
|
|
|
edict_t *e2;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
/* connect time, ping, score, name */
|
2019-09-23 19:44:35 +00:00
|
|
|
*text = '\0';
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
for (i = 0, e2 = g_edicts + 1; i < maxclients->value; i++, e2++)
|
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!e2->inuse)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
continue;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
Com_sprintf(st, sizeof(st), "%02d:%02d %4d %3d %s%s\n",
|
2013-05-01 08:43:49 +00:00
|
|
|
(level.framenum - e2->client->resp.enterframe) / 600,
|
|
|
|
((level.framenum - e2->client->resp.enterframe) % 600) / 10,
|
|
|
|
e2->client->ping, e2->client->resp.score,
|
|
|
|
e2->client->pers.netname,
|
|
|
|
e2->client->resp.spectator ? " (spectator)" : "");
|
|
|
|
|
2019-09-23 19:44:35 +00:00
|
|
|
text_len = strlen(text);
|
|
|
|
|
|
|
|
if ((text_len + strlen(st)) > (sizeof(text) - 50))
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2019-09-23 19:44:35 +00:00
|
|
|
snprintf(text + text_len, sizeof(text) - text_len, "And more...\n");
|
2009-03-12 20:03:41 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
strcat(text, st);
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
gi.cprintf(ent, PRINT_HIGH, "%s", text);
|
|
|
|
}
|
|
|
|
|
2019-09-05 14:51:53 +00:00
|
|
|
void
|
|
|
|
Cmd_Teleport_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gi.argc() != 4)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Usage: teleport x y z\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unlink it to prevent unwanted interactions with
|
|
|
|
other entities. This works because linkentity()
|
|
|
|
uses the first available slot and the player is
|
|
|
|
always at postion 0. */
|
|
|
|
gi.unlinkentity(ent);
|
|
|
|
|
|
|
|
/* Set new position */
|
|
|
|
ent->s.origin[0] = atof(gi.argv(1));
|
|
|
|
ent->s.origin[1] = atof(gi.argv(2));
|
|
|
|
ent->s.origin[2] = atof(gi.argv(3)) + 10.0;
|
|
|
|
|
|
|
|
/* Remove velocity and keep the entity briefly in place
|
|
|
|
to give the server and clients time to catch up. */
|
|
|
|
VectorClear(ent->velocity);
|
|
|
|
ent->client->ps.pmove.pm_time = 20;
|
|
|
|
ent->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;
|
|
|
|
|
|
|
|
/* Remove viewangles. They'll be recalculated
|
|
|
|
by the client at the next frame. */
|
|
|
|
VectorClear(ent->s.angles);
|
|
|
|
VectorClear(ent->client->ps.viewangles);
|
|
|
|
VectorClear(ent->client->v_angle);
|
|
|
|
|
|
|
|
/* Telefrag everything that's in the target location. */
|
|
|
|
KillBox(ent);
|
|
|
|
|
|
|
|
/* And link it back in. */
|
|
|
|
gi.linkentity(ent);
|
|
|
|
}
|
|
|
|
|
2019-09-05 15:45:31 +00:00
|
|
|
void
|
|
|
|
Cmd_ListEntities_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
if ((deathmatch->value || coop->value) && !sv_cheats->value)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "You must run the server with '+set cheats 1' to enable this command.\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gi.argc() < 2)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Usage: listentities <all|ammo|items|keys|monsters|weapons>\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* What to print? */
|
|
|
|
qboolean all = false;
|
|
|
|
qboolean ammo = false;
|
|
|
|
qboolean items = false;
|
|
|
|
qboolean keys = false;
|
|
|
|
qboolean monsters = false;
|
|
|
|
qboolean weapons = false;
|
|
|
|
|
|
|
|
for (int i = 1; i < gi.argc(); i++)
|
|
|
|
{
|
|
|
|
const char *arg = gi.argv(i);
|
|
|
|
|
|
|
|
if (Q_stricmp(arg, "all") == 0)
|
|
|
|
{
|
|
|
|
all = true;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(arg, "ammo") == 0)
|
|
|
|
{
|
|
|
|
ammo = true;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(arg, "items") == 0)
|
|
|
|
{
|
|
|
|
items = true;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(arg, "keys") == 0)
|
|
|
|
{
|
|
|
|
keys = true;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(arg, "monsters") == 0)
|
|
|
|
{
|
|
|
|
monsters = true;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(arg, "weapons") == 0)
|
|
|
|
{
|
|
|
|
weapons = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Usage: listentities <all|ammo|items|keys|monsters|weapons>\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print what's requested. */
|
|
|
|
for (int i = 0; i < globals.num_edicts; i++)
|
|
|
|
{
|
|
|
|
edict_t *cur = &g_edicts[i];
|
|
|
|
qboolean print = false;
|
|
|
|
|
2019-09-07 12:26:42 +00:00
|
|
|
/* Ensure that the entity is valid. */
|
|
|
|
if (!cur->classname)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2019-09-05 15:45:31 +00:00
|
|
|
if (all)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ammo)
|
|
|
|
{
|
|
|
|
if (strncmp(cur->classname, "ammo_", 5) == 0)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (items)
|
|
|
|
{
|
|
|
|
if (strncmp(cur->classname, "item_", 5) == 0)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (keys)
|
|
|
|
{
|
|
|
|
if (strncmp(cur->classname, "key_", 4) == 0)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (monsters)
|
|
|
|
{
|
|
|
|
if (strncmp(cur->classname, "monster_", 8) == 0)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weapons)
|
|
|
|
{
|
|
|
|
if (strncmp(cur->classname, "weapon_", 7) == 0)
|
|
|
|
{
|
|
|
|
print = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (print)
|
|
|
|
{
|
|
|
|
/* We use dprintf() because cprintf() may flood the server... */
|
|
|
|
gi.dprintf("%s: %f %f %f\n", cur->classname, cur->s.origin[0], cur->s.origin[1], cur->s.origin[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-29 11:30:26 +00:00
|
|
|
static int
|
|
|
|
get_ammo_usage(gitem_t *weap)
|
|
|
|
{
|
|
|
|
if (!weap)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* handles grenades and tesla which only use 1 ammo per shot */
|
|
|
|
/* have to check this because they don't store their ammo usage in weap->quantity */
|
|
|
|
if (weap->flags & IT_AMMO)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* weapons store their ammo usage in the quantity field */
|
|
|
|
return weap->quantity;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gitem_t *
|
|
|
|
cycle_weapon(edict_t *ent)
|
|
|
|
{
|
|
|
|
gclient_t *cl;
|
|
|
|
gitem_t *noammo_fallback;
|
|
|
|
gitem_t *noweap_fallback;
|
|
|
|
gitem_t *weap;
|
|
|
|
gitem_t *ammo;
|
|
|
|
int i;
|
|
|
|
int start;
|
|
|
|
int num_weaps;
|
2022-08-01 18:35:42 +00:00
|
|
|
const char *weapname = NULL;
|
2019-09-29 11:30:26 +00:00
|
|
|
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (!cl)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_weaps = gi.argc();
|
|
|
|
|
|
|
|
/* find where we want to start the search for the next eligible weapon */
|
2022-08-01 18:35:42 +00:00
|
|
|
if (cl->newweapon)
|
|
|
|
{
|
|
|
|
weapname = cl->newweapon->classname;
|
|
|
|
}
|
|
|
|
else if (cl->pers.weapon)
|
|
|
|
{
|
|
|
|
weapname = cl->pers.weapon->classname;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (weapname)
|
2019-09-29 11:30:26 +00:00
|
|
|
{
|
|
|
|
for (i = 1; i < num_weaps; i++)
|
|
|
|
{
|
2022-08-01 18:35:42 +00:00
|
|
|
if (Q_stricmp(weapname, gi.argv(i)) == 0)
|
2019-09-29 11:30:26 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
if (i >= num_weaps)
|
|
|
|
{
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
start = i;
|
|
|
|
noammo_fallback = NULL;
|
|
|
|
noweap_fallback = NULL;
|
|
|
|
|
|
|
|
/* find the first eligible weapon in the list we can switch to */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
weap = FindItemByClassname(gi.argv(i));
|
|
|
|
|
2019-09-29 11:45:44 +00:00
|
|
|
if (weap && weap != cl->pers.weapon && (weap->flags & IT_WEAPON) && weap->use)
|
2019-09-29 11:30:26 +00:00
|
|
|
{
|
|
|
|
if (cl->pers.inventory[ITEM_INDEX(weap)] > 0)
|
|
|
|
{
|
|
|
|
if (weap->ammo)
|
|
|
|
{
|
|
|
|
ammo = FindItem(weap->ammo);
|
|
|
|
if (ammo)
|
|
|
|
{
|
|
|
|
if (cl->pers.inventory[ITEM_INDEX(ammo)] >= get_ammo_usage(weap))
|
|
|
|
{
|
|
|
|
return weap;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!noammo_fallback)
|
|
|
|
{
|
|
|
|
noammo_fallback = weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!noweap_fallback)
|
|
|
|
{
|
|
|
|
noweap_fallback = weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
if (i >= num_weaps)
|
|
|
|
{
|
|
|
|
i = 1;
|
|
|
|
}
|
|
|
|
} while (i != start);
|
|
|
|
|
|
|
|
/* if no weapon was found, the fallbacks will be used for
|
|
|
|
printing the appropriate error message to the console
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (noammo_fallback)
|
|
|
|
{
|
|
|
|
return noammo_fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
return noweap_fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Cmd_CycleWeap_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
gitem_t *weap;
|
|
|
|
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gi.argc() <= 1)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Usage: cycleweap classname1 classname2 .. classnameN\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
weap = cycle_weapon(ent);
|
|
|
|
if (weap)
|
|
|
|
{
|
|
|
|
if (ent->client->pers.inventory[ITEM_INDEX(weap)] <= 0)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
weap->use(ent, weap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-11 13:53:13 +00:00
|
|
|
static gitem_t *
|
|
|
|
preferred_weapon(edict_t *ent)
|
|
|
|
{
|
|
|
|
gclient_t *cl;
|
|
|
|
gitem_t *noammo_fallback;
|
|
|
|
gitem_t *noweap_fallback;
|
|
|
|
gitem_t *weap;
|
|
|
|
gitem_t *ammo;
|
|
|
|
int i;
|
|
|
|
int num_weaps;
|
|
|
|
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl = ent->client;
|
|
|
|
|
|
|
|
if (!cl)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_weaps = gi.argc();
|
|
|
|
noammo_fallback = NULL;
|
|
|
|
noweap_fallback = NULL;
|
|
|
|
|
|
|
|
/* find the first eligible weapon in the list we can switch to */
|
|
|
|
for (i = 1; i < num_weaps; i++)
|
|
|
|
{
|
|
|
|
weap = FindItemByClassname(gi.argv(i));
|
|
|
|
|
|
|
|
if (weap && (weap->flags & IT_WEAPON) && weap->use)
|
|
|
|
{
|
|
|
|
if (cl->pers.inventory[ITEM_INDEX(weap)] > 0)
|
|
|
|
{
|
|
|
|
if (weap->ammo)
|
|
|
|
{
|
|
|
|
ammo = FindItem(weap->ammo);
|
|
|
|
if (ammo)
|
|
|
|
{
|
|
|
|
if (cl->pers.inventory[ITEM_INDEX(ammo)] >= get_ammo_usage(weap))
|
|
|
|
{
|
|
|
|
return weap;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!noammo_fallback)
|
|
|
|
{
|
|
|
|
noammo_fallback = weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!noweap_fallback)
|
|
|
|
{
|
|
|
|
noweap_fallback = weap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if no weapon was found, the fallbacks will be used for
|
|
|
|
printing the appropriate error message to the console
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (noammo_fallback)
|
|
|
|
{
|
|
|
|
return noammo_fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
return noweap_fallback;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
Cmd_PrefWeap_f(edict_t *ent)
|
|
|
|
{
|
|
|
|
gitem_t *weap;
|
|
|
|
|
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gi.argc() <= 1)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Usage: prefweap classname1 classname2 .. classnameN\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
weap = preferred_weapon(ent);
|
|
|
|
if (weap)
|
|
|
|
{
|
|
|
|
if (ent->client->pers.inventory[ITEM_INDEX(weap)] <= 0)
|
|
|
|
{
|
|
|
|
gi.cprintf(ent, PRINT_HIGH, "Out of item: %s\n", weap->pickup_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
weap->use(ent, weap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
void
|
|
|
|
ClientCommand(edict_t *ent)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
char *cmd;
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (!ent)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-02-22 12:20:22 +00:00
|
|
|
|
2009-03-12 20:03:41 +00:00
|
|
|
if (!ent->client)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
|
|
|
return; /* not fully in game yet */
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
|
|
|
cmd = gi.argv(0);
|
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
if (Q_stricmp(cmd, "players") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Cmd_Players_f(ent);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (Q_stricmp(cmd, "say") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Cmd_Say_f(ent, false, false);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (Q_stricmp(cmd, "say_team") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Cmd_Say_f(ent, true, false);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (Q_stricmp(cmd, "score") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Cmd_Score_f(ent);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
|
|
|
|
if (Q_stricmp(cmd, "help") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
2013-05-01 08:43:49 +00:00
|
|
|
Cmd_Help_f(ent);
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (level.intermissiontime)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
return;
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
|
2013-05-01 08:43:49 +00:00
|
|
|
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);
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
else if (Q_stricmp(cmd, "playerlist") == 0)
|
2013-05-01 08:43:49 +00:00
|
|
|
{
|
2009-03-12 20:03:41 +00:00
|
|
|
Cmd_PlayerList_f(ent);
|
2013-05-01 08:43:49 +00:00
|
|
|
}
|
|
|
|
else if (Q_stricmp(cmd, "entcount") == 0)
|
|
|
|
{
|
|
|
|
Cmd_Ent_Count_f(ent);
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(cmd, "disguise") == 0)
|
2009-03-12 20:03:41 +00:00
|
|
|
{
|
|
|
|
ent->flags |= FL_DISGUISED;
|
|
|
|
}
|
2019-09-05 14:51:53 +00:00
|
|
|
else if (Q_stricmp(cmd, "teleport") == 0)
|
|
|
|
{
|
|
|
|
Cmd_Teleport_f(ent);
|
|
|
|
}
|
2019-09-05 15:45:31 +00:00
|
|
|
else if (Q_stricmp(cmd, "listentities") == 0)
|
|
|
|
{
|
|
|
|
Cmd_ListEntities_f(ent);
|
|
|
|
}
|
2019-09-29 11:30:26 +00:00
|
|
|
else if (Q_stricmp(cmd, "cycleweap") == 0)
|
|
|
|
{
|
|
|
|
Cmd_CycleWeap_f(ent);
|
|
|
|
}
|
2022-04-11 13:53:13 +00:00
|
|
|
else if (Q_stricmp(cmd, "prefweap") == 0)
|
|
|
|
{
|
|
|
|
Cmd_PrefWeap_f(ent);
|
|
|
|
}
|
2013-05-01 08:43:49 +00:00
|
|
|
else /* anything that doesn't match a command will be a chat */
|
|
|
|
{
|
|
|
|
Cmd_Say_f(ent, false, true);
|
|
|
|
}
|
2009-03-12 20:03:41 +00:00
|
|
|
}
|
2009-03-31 09:18:35 +00:00
|
|
|
|