*/
static void SV_Map_f(cmd_state_t *cmd)
{
- char level[MAX_QPATH];
-
if (Cmd_Argc(cmd) != 2)
{
Con_Print("map <levelname> : start a new game (kicks off all players)\n");
host.hook.ToggleMenu();
svs.serverflags = 0; // haven't completed an episode yet
- dp_strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
- SV_SpawnServer(level);
+ SV_SpawnServer(Cmd_Argv(cmd, 1));
if(sv.active && host.hook.ConnectLocal != NULL)
host.hook.ConnectLocal();
*/
static void SV_Changelevel_f(cmd_state_t *cmd)
{
- char level[MAX_QPATH];
-
if (Cmd_Argc(cmd) != 2)
{
Con_Print("changelevel <levelname> : continue game on a new level\n");
if (!sv.active)
{
- Con_Printf("You must be running a server to changelevel. Use 'map %s' instead\n", Cmd_Argv(cmd, 1));
+ SV_Map_f(cmd);
return;
}
host.hook.ToggleMenu();
SV_SaveSpawnparms ();
- dp_strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
- SV_SpawnServer(level);
+ SV_SpawnServer(Cmd_Argv(cmd, 1));
if(sv.active && host.hook.ConnectLocal != NULL)
host.hook.ConnectLocal();
*/
static void SV_Restart_f(cmd_state_t *cmd)
{
- char mapname[MAX_QPATH];
-
if (Cmd_Argc(cmd) != 1)
{
Con_Print("restart : restart current level\n");
if(host.hook.ToggleMenu)
host.hook.ToggleMenu();
- dp_strlcpy(mapname, sv.worldbasename, sizeof(mapname));
- SV_SpawnServer(mapname);
+ SV_SpawnServer(sv.worldbasename);
if(sv.active && host.hook.ConnectLocal != NULL)
host.hook.ConnectLocal();
prvm_prog_t *prog = SVVM_prog;
const char *t;
int v;
+ int player_items;
t = Cmd_Argv(cmd, 1);
v = atoi (Cmd_Argv(cmd, 2));
PRVM_serveredictfloat(host_client->edict, ammo_cells) = v;
}
break;
+ case 'a':
+ //
+ // Set the player armour value to the number specified and then adjust the armour type/colour based on the value
+ //
+ player_items = PRVM_serveredictfloat(host_client->edict, items);
+ PRVM_serveredictfloat(host_client->edict, armorvalue) = v;
+
+ // Remove whichever armour item the player currently has
+ if (gamemode == GAME_ROGUE)
+ player_items &= ~(RIT_ARMOR1 | RIT_ARMOR2 | RIT_ARMOR3);
+ else
+ player_items &= ~(IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3);
+
+ if (v > 150)
+ {
+ // Give red armour
+ PRVM_serveredictfloat(host_client->edict, armortype) = 0.8;
+ if (gamemode == GAME_ROGUE)
+ player_items |= RIT_ARMOR3;
+ else
+ player_items |= IT_ARMOR3;
+ }
+ else if (v > 100)
+ {
+ // Give yellow armour
+ PRVM_serveredictfloat(host_client->edict, armortype) = 0.6;
+ if (gamemode == GAME_ROGUE)
+ player_items |= RIT_ARMOR2;
+ else
+ player_items |= IT_ARMOR2;
+ }
+ else if (v >= 0)
+ {
+ // Give green armour
+ PRVM_serveredictfloat(host_client->edict, armortype) = 0.3;
+ if (gamemode == GAME_ROGUE)
+ player_items |= RIT_ARMOR1;
+ else
+ player_items |= IT_ARMOR1;
+ }
+
+ PRVM_serveredictfloat(host_client->edict, items) = player_items;
+ break;
}
}
Cmd_AddCommand(CF_SERVER | CF_SERVER_FROM_CLIENT, "status", SV_Status_f, "print server status information");
Cmd_AddCommand(CF_SHARED, "map", SV_Map_f, "kick everyone off the server and start a new level");
Cmd_AddCommand(CF_SHARED, "restart", SV_Restart_f, "restart current level");
- Cmd_AddCommand(CF_SHARED, "changelevel", SV_Changelevel_f, "change to another level, bringing along all connected clients");
+ Cmd_AddCommand(CF_SHARED, "changelevel", SV_Changelevel_f, "change to another level, bringing along all connected clients (or start a new level if none is loaded)");
Cmd_AddCommand(CF_SHARED | CF_SERVER_FROM_CLIENT, "say", SV_Say_f, "send a chat message to everyone on the server");
Cmd_AddCommand(CF_SERVER_FROM_CLIENT, "say_team", SV_Say_Team_f, "send a chat message to your team on the server");
Cmd_AddCommand(CF_SHARED | CF_SERVER_FROM_CLIENT, "tell", SV_Tell_f, "send a chat message to only one person on the server");