From c15ea9ef49c8a0696dce11f9a9be1421371f6606 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Sat, 13 Oct 2018 14:11:21 +0100 Subject: [PATCH] adds /viewpolicechat for level 5 admins --- gamemodes/irresistible/cnr/commands/admin/_admin.pwn | 1 + .../irresistible/cnr/commands/admin/admin_five.pwn | 12 ++++++++++++ gamemodes/irresistible/cnr/player.pwn | 1 + gamemodes/sf-cnr.pwn | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index 92a959b..20c6223 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -156,6 +156,7 @@ static stock { 5, "/destroybusiness", "Deletes a business" }, { 5, "/seteventhost", "Setting event host to player" }, { 5, "/weather", "Settings world weather" }, + { 5, "/viewpolicechat", "Viewing the police radio/chat" }, /* ** Level 6 Commands ** */ { 6, "/reloadeditor", "Reloads object editer script" }, diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn index 6630a21..cc492a1 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn @@ -20,6 +20,18 @@ CMD:armorall( playerid, params[ ] ) return 1; } +CMD:viewpolicechat( playerid, params[ ] ) +{ + if ( p_AdminLevel[ playerid ] < 5 && !IsPlayerUnderCover( playerid ) ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + p_ToggleCopChat{ playerid } = !p_ToggleCopChat{ playerid }; + + SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have %s viewing police.", p_ToggleCopChat{ playerid } == true ? ("toggled") : ("un-toggled") ); + if ( !IsPlayerUnderCover( playerid ) ) { + AddAdminLogLineFormatted( "%s(%d) has %s viewing police chat", ReturnPlayerName( playerid ), playerid, p_ToggleCopChat{ playerid } == true ? ("toggled") : ("un-toggled") ); + } + return 1; +} + CMD:check( playerid, params[ ] ) { new diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 1953156..0fb853b 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -39,6 +39,7 @@ new p_Ropes [ MAX_PLAYERS ], bool: p_Kidnapped [ MAX_PLAYERS char ], bool: p_ToggledViewPM [ MAX_PLAYERS char ], + bool: p_ToggleCopChat [ MAX_PLAYERS char ], p_TicketTimestamp [ MAX_PLAYERS ], p_TicketIssuer [ MAX_PLAYERS ] = { INVALID_PLAYER_ID, ... }, p_CheckpointEnterTick [ MAX_PLAYERS ], diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 8a2f7c6..b2d5ee9 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -3427,6 +3427,14 @@ public OnPlayerText( playerid, text[ ] ) } } SendClientMessageToCops( -1, ""COL_BLUE" %s(%d):"COL_WHITE" %s", ReturnPlayerName( playerid ), playerid, szBigString[ 1 ] ); + + foreach(new i : Player) + { + if ( ( p_AdminLevel[ i ] >= 5 || IsPlayerUnderCover( i ) ) && p_ToggleCopChat{ i } == true ) + { + SendClientMessageFormatted( i, -1, ""COL_BLUE" %s(%d):"COL_GREY" %s", ReturnPlayerName( playerid ), playerid, szBigString[ 1 ] ); + } + } return 0; }