From 05e994fe4606ff1d6b2c14dd49115247d5c14008 Mon Sep 17 00:00:00 2001 From: Steven Howard Date: Tue, 25 Sep 2018 14:58:05 +0100 Subject: [PATCH] changed force command errors changed dialog outputs for /reports and /questons added /mutelist into a dialog base --- .../cnr/commands/admin/admin_five.pwn | 4 +- .../cnr/commands/admin/admin_one.pwn | 58 ++++++++++++------- gamemodes/sf-cnr.pwn | 8 ++- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn index d3b079c..79f2a5c 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_five.pwn @@ -1,4 +1,4 @@ -/* + /* * Irresistible Gaming (c) 2018 * Developed by Lorenc Pekaj * Module: cnr/commands/admin/admin_five.pwn @@ -746,7 +746,7 @@ CMD:forceac( playerid, params[ ] ) if ( p_AdminLevel[ playerid ] < 5 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); else if ( sscanf( params, "u", pID ) ) SendUsage( playerid, "/forceac [PLAYER_ID]" ); else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); - else if ( pID == playerid ) return SendError( playerid, "You cant kick yourself." ); + else if ( pID == playerid ) return SendError( playerid, "You cant use this command on yourself." ); else if ( p_AdminLevel[ pID ] > p_AdminLevel[ playerid ] ) return SendError( playerid, "You cannot use this command on admins higher than your level." ); //else if ( GetPlayerScore( pID ) < 100 ) return SendError( playerid, "This player's score is under 100, please spectate instead." ); else diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn index 238c384..189852e 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn @@ -88,12 +88,17 @@ CMD:reports( playerid, params[ ] ) { if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - if ( !strlen( szReportsLog[ 7 ] ) ) - szLargeString = "None at the moment."; - else - format( szLargeString, sizeof( szLargeString ), "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", szReportsLog[ 0 ], szReportsLog[ 1 ], szReportsLog[ 2 ], szReportsLog[ 3 ], szReportsLog[ 4 ], szReportsLog[ 5 ], szReportsLog[ 6 ], szReportsLog[ 7 ] ); + szLargeString = ""COL_GREY"Date\t"COL_GREY"Reported By\t"COL_GREY"Reported\t"COL_GREY"Message\n"; - ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_LIST, "{FFFFFF}Report Log", szLargeString, "Okay", "" ); + if ( !strlen( szReportsLog[ 7 ] ) ) + return SendError( playerid, "There is no reports at the moment." ); + + for (new i = 0; i < 8; i ++) + { + format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, szReportsLog[ i ] ); + } + + ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Report Log", szLargeString, "Okay", "" ); return 1; } @@ -101,12 +106,17 @@ CMD:questions( playerid, params[ ] ) { if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - if ( !strlen( szQuestionsLog[ 7 ] ) ) - szLargeString = "None at the moment."; - else - format( szLargeString, sizeof( szLargeString ), "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", szQuestionsLog[ 0 ], szQuestionsLog[ 1 ], szQuestionsLog[ 2 ], szQuestionsLog[ 3 ], szQuestionsLog[ 4 ], szQuestionsLog[ 5 ], szQuestionsLog[ 6 ], szQuestionsLog[ 7 ] ); + szLargeString = ""COL_GREY"Date\t"COL_GREY"Player\t"COL_GREY"Question\n"; - ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_LIST, "{FFFFFF}Question Log", szLargeString, "Okay", "" ); + if ( !strlen( szQuestionsLog[ 7 ] ) ) + return SendError( playerid, "There is no questions at the moment." ); + + for (new i = 0; i < 8; i ++) + { + format( szLargeString, sizeof( szLargeString ), "%s%s\n", szLargeString, szQuestionsLog[ i ] ); + } + + ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST_HEADERS, "{FFFFFF}Question Log", szLargeString, "Okay", "" ); return 1; } @@ -678,18 +688,26 @@ CMD:goto( playerid, params[ ] ) CMD:mutelist( playerid, params[ ] ) { new - count = 0, time = g_iTime; + count = 0; if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - SendClientMessage( playerid, COLOR_PINK, ".: Mute List :." ); - foreach(new i : Player) + + szNormalString[ 0 ] = '\0'; + foreach( new i : Player ) { - if ( p_Muted{ i } == true && time < p_MutedTime[ i ] ) - { - SendClientMessageFormatted( playerid, COLOR_GREY, "%s (%s)", ReturnPlayerName( i ), secondstotime( p_MutedTime[ i ] - time ) ); - count++; - } + if ( p_Muted{ i } && g_iTime < p_MutedTime[ i ] ) + { + format( szNormalString, sizeof( szNormalString ), "%s"COL_WHITE"%s(%d)\t"COL_GREY"%s\n", + szNormalString, + ReturnPlayerName( i ), i, + secondstotime( p_MutedTime[ i ] - g_iTime ) + ); + + count ++; + } } - if ( count == 0 ) SendClientMessage( playerid, COLOR_GREY, "There are no muted players online." ); - return 1; + if ( count == 0 ) + return SendError( playerid, "There are no muted players online." ); + else + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Muted List", szNormalString, "Close", "" ), 1; } diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index e976c38..96560d0 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -4832,6 +4832,8 @@ public OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart ) public OnPlayerDeath( playerid, killerid, reason ) #endif { + printf( "[OnPlayerDeathEx] %d, %d, %d, %f, %d", playerid, killerid, reason, damage, bodypart ); + if ( !p_PlayerLogged{ playerid } ) { return SendServerMessage( playerid, "Possible Fake-kill detected - 0x0A" ), KickPlayerTimed( playerid ); } @@ -5073,6 +5075,8 @@ public OnPlayerDeath( playerid, killerid, reason ) } ClearPlayerWantedLevel( playerid ); + + printf( "[OnPlayerDeathEx] %d, %d, %d, %f, %d", playerid, killerid, reason, damage, bodypart ); return 1; } @@ -8136,7 +8140,7 @@ CMD:ask( playerid, params[ ] ) for( new iPos; iPos < sizeof( szQuestionsLog ) - 1; iPos++ ) memcpy( szQuestionsLog[ iPos ], szQuestionsLog[ iPos + 1 ], 0, sizeof( szQuestionsLog[ ] ) * 4 ); - format( szNormalString, sizeof( szNormalString ), "[%s] %s: %s\n", getCurrentTime( ), ReturnPlayerName( playerid ), szMessage ); + format( szNormalString, sizeof( szNormalString ), "%s\t%s(%d)\t%s\n", getCurrentTime( ), ReturnPlayerName( playerid ), playerid, szMessage ); strcpy( szQuestionsLog[ 7 ], szNormalString ); Beep( playerid ); @@ -9230,7 +9234,7 @@ CMD:report( playerid, params[ ] ) for( new iPos; iPos < sizeof( szReportsLog ) - 1; iPos++ ) memcpy( szReportsLog[ iPos ], szReportsLog[ iPos + 1 ], 0, sizeof( szReportsLog[ ] ) * 4 ); - format( szNormalString, sizeof( szNormalString ), "[%s] %s(%d): %s\n", getCurrentTime( ), ReturnPlayerName( iPlayer ), iPlayer, szMessage ); + format( szNormalString, sizeof( szNormalString ), "%s\t%s(%d)\t%s(%d)\t%s\n", getCurrentTime( ), ReturnPlayerName( playerid ), playerid, ReturnPlayerName( iPlayer ), iPlayer, szMessage ); strcpy( szReportsLog[ 7 ], szNormalString ); Beep( playerid );