Added notarget and fly commands (and a cast for q2 gamecode's usercmds)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@742 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-01-07 02:36:13 +00:00
parent 340acfd808
commit 9f7ca44459

View file

@ -2355,16 +2355,23 @@ void SV_Vote_f (void)
extern qboolean sv_allow_cheats; extern qboolean sv_allow_cheats;
//Sets client to godmode void Cmd_Notarget_f (void)
void Cmd_God_f (void)
{ {
if (!sv_allow_cheats)
{
Con_Printf ("Cheats are not allowed on this server\n");
return;
}
if ((int) (sv_player->v.flags = (int) sv_player->v.flags ^ FL_NOTARGET) & FL_NOTARGET) if ((int) (sv_player->v.flags = (int) sv_player->v.flags ^ FL_NOTARGET) & FL_NOTARGET)
SV_ClientPrintf (host_client, PRINT_HIGH, "notarget ON\n"); SV_ClientPrintf (host_client, PRINT_HIGH, "notarget ON\n");
else else
SV_ClientPrintf (host_client, PRINT_HIGH, "notarget OFF\n"); SV_ClientPrintf (host_client, PRINT_HIGH, "notarget OFF\n");
}
//Sets client to godmode
void Cmd_God_f (void)
{
if (!sv_allow_cheats) if (!sv_allow_cheats)
{ {
Con_Printf ("Cheats are not allowed on this server\n"); Con_Printf ("Cheats are not allowed on this server\n");
@ -2460,6 +2467,30 @@ void Cmd_Noclip_f (void)
} }
} }
void Cmd_Fly_f (void)
{
if (!sv_allow_cheats)
{
Con_Printf ("Cheats are not allowed on this server\n");
return;
}
if (sv_player->v.movetype != MOVETYPE_FLY)
{
sv_player->v.movetype = MOVETYPE_FLY;
SV_ClientPrintf (host_client, PRINT_HIGH, "flymode ON\n");
}
else
{
sv_player->v.movetype = MOVETYPE_WALK;
if (sv_player->v.health > 0)
sv_player->v.solid = SOLID_SLIDEBOX;
else
sv_player->v.solid = SOLID_NOT;
SV_ClientPrintf (host_client, PRINT_HIGH, "flymode OFF\n");
}
}
/* /*
==================== ====================
Host_SetPos_f UDC Host_SetPos_f UDC
@ -2716,6 +2747,8 @@ ucmd_t ucmds[] =
{"god", Cmd_God_f}, {"god", Cmd_God_f},
{"give", Cmd_Give_f}, {"give", Cmd_Give_f},
{"noclip", Cmd_Noclip_f}, {"noclip", Cmd_Noclip_f},
{"fly", Cmd_Fly_f},
{"notarget", Cmd_Notarget_f},
{"setpos", Cmd_SetPos_f}, {"setpos", Cmd_SetPos_f},
// {"stopdownload", SV_StopDownload_f}, // {"stopdownload", SV_StopDownload_f},
@ -3195,7 +3228,7 @@ ucmd_t nqucmds[] =
{"god", Cmd_God_f}, {"god", Cmd_God_f},
{"give", Cmd_Give_f}, {"give", Cmd_Give_f},
{"notarget", NULL}, {"notarget", Cmd_Notarget_f},
{"fly", NULL}, {"fly", NULL},
{"noclip", Cmd_Noclip_f}, {"noclip", Cmd_Noclip_f},
@ -3584,7 +3617,7 @@ void SV_RunCmd (usercmd_t *ucmd, qboolean recurse)
#ifdef Q2SERVER #ifdef Q2SERVER
if (!svprogfuncs) if (!svprogfuncs)
{ {
ge->ClientThink (host_client->q2edict, ucmd); ge->ClientThink (host_client->q2edict, (q2usercmd_t*)ucmd);
return; return;
} }
#endif #endif