Skip to content

Commit

Permalink
Server|libcommon: If cheats are disabled, send clients attempting to …
Browse files Browse the repository at this point in the history
…cheat a response

Rather than quietly ignore the client's attempt to cheat, the server
will now respond by sending the client a game message to inform them
that cheats are disabled.
  • Loading branch information
danij-deng committed Sep 5, 2012
1 parent 2980aee commit 2a72a26
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions doomsday/plugins/common/src/d_netsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,18 +1285,25 @@ void NetSv_SendJumpPower(int target, float power)
void NetSv_ExecuteCheat(int player, const char* command)
{
// Killing self is always allowed.
/// @todo fixme: really? Even in deathmatch??
if(!strnicmp(command, "suicide", 7))
{
DD_Executef(false, "suicide %i", player);
}
else if(netSvAllowCheats) // If cheating is not allowed, we ain't doing nuthin'.

// If cheating is not allowed, we ain't doing nuthin'.
if(!netSvAllowCheats)
{
if(!strnicmp(command, "god", 3) ||
!strnicmp(command, "noclip", 6) ||
!strnicmp(command, "give", 4))
{
DD_Executef(false, "%s %i", command, player);
}
NetSv_SendMessage(player, "--- CHEATS DISABLED ON THIS SERVER ---");
return;
}

/// @todo Can't we use the multipurpose cheat command here?
if(!strnicmp(command, "god", 3) ||
!strnicmp(command, "noclip", 6) ||
!strnicmp(command, "give", 4))
{
DD_Executef(false, "%s %i", command, player);
}
}

Expand Down

0 comments on commit 2a72a26

Please sign in to comment.