diff --git a/gamemodes/irresistible/cnr/auth/account.pwn b/gamemodes/irresistible/cnr/auth/account.pwn index ec63404..ad59eb0 100644 --- a/gamemodes/irresistible/cnr/auth/account.pwn +++ b/gamemodes/irresistible/cnr/auth/account.pwn @@ -315,6 +315,10 @@ thread OnAttemptPlayerLogin( playerid, password[ ] ) // Log in player SendServerMessage( playerid, "You have " COL_GREEN "successfully" COL_WHITE " logged in!" ); + + // Chat Ban Player + format( szBigString, sizeof( szBigString ), "SELECT * FROM `CHAT_BANS` WHERE `ID` = '%d' LIMIT 0,1", p_AccountID[ playerid ] ); + mysql_function_query( dbHandle, szBigString, true, "ChatBanUponLogin", "d", playerid ); } else { diff --git a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn index 68c1e89..2c3137b 100644 --- a/gamemodes/irresistible/cnr/commands/admin/_admin.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/_admin.pwn @@ -72,11 +72,13 @@ static stock { 2, "/mute", "Muting a player" }, { 2, "/unmute", "Unmuting a player" }, { 2, "/kick", "Kicking a player from the server" }, + { 2, "/smlog", "Cash transaction log from a player" }, + { 2, "/iclog", "IC transaction log from a player" }, /* ** Level 3 Commands ** */ + { 3, "/chatban", "Bans a player from using all forms of chat" }, + { 3, "/unchatban", "Unbans a player from using all forms of chat" }, { 3, "/banlog", "Finding ban information about a player" }, - { 3, "/smlog", "Cash transaction log from a player" }, - { 3, "/iclog", "IC transaction log from a player" }, { 3, "/resetwep", "Resetting weapons from a player" }, { 3, "/getip", "Getting IP of a player" }, { 3, "/geolocate", "Geographical location of a player" }, @@ -105,6 +107,7 @@ static stock { 3, "/countdown", "Countdown" }, { 3, "/pingimmune", "Making a player immune from ping kicker" }, { 3, "/ban", "Banning a player" }, + { 3, "/forceac" "Force a player to use CAC while playing the server" }, { 3, "/bring", "Bring a player to you" }, /* ** Level 4 Commands ** */ @@ -260,34 +263,6 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] ) return 1; } -/*CMD:acmds( playerid, params[ ] ) -{ - if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - SendClientMessage( playerid, COLOR_GREY, "|______________________________________| Admin Commands |_____________________________________|" ); - SendClientMessage( playerid, COLOR_WHITE, " " ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 1: /goto, /spec(off), /(un)jail, /asay, /slap, /a, /getstats, /stpfr, /setskin, /frules, /fpc, /ticketlog" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 1: /pinfo, /warn, /aspawn, /ans, /stpfa, /alog, /(un)freeze, /aod, /respawnalluv, /reports, /questions" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 1: /respond, /mutelist, /aka, /arepair, /viewdeathmsg" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 2: /kick, /vdestroy, /(un)mute, /explode, /vrespawn, /arenas, /suspend, /viewnotes, /slay" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 3: /ban, /bring, /clearchat, /(ann)ounce, /giveweapon, /vadminpark, /vcreate, /healall, /getip, /smlog, /iclog" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 3: /vadminstats, /pingimmune, /vbring, /countdown, /forcecoptutorial, /vgoto, /copwarn, /armywarn, /resetwep" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 3: /venter, /geolocate" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 4: /circleall, /giveweaponall, /resetwepall, /motd, /uncopban, /unarmyban, /setworld, /destroyallav, /gotopos" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 4: /addnote, /removenote" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createhouse, /destroyhouse, /respawnallv, /achangename, /toggleviewpm, /unban(ip)" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /createcar, /destroycar, /stripcarmods, /createbribe, /destroybribe, /doublexp, /(h/v)adminsell" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /autovehrespawn, /megaban, /acunban, /creategate, /editgate, /connectsong, /discordurl" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 5: /creategarage, /destroygarage, /check, /reconnectchuff" ); - - if ( p_AdminLevel[ playerid ] > 5 ) { - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 6: /setirc, /seteventhost, /setlevel, /setleveloffline, /svrstats, /playaction, /playanimation" ); - SendClientMessage( playerid, COLOR_WHITE, " LEVEL 6: /updaterules, /truncate, /broadcast, /setgangleader, /viewgangtalk, /createentrance, /destroyentrance" ); - } - - SendClientMessage( playerid, COLOR_GREY, "|_____________________________________________________________________________________________|" ); - return 1; -}*/ - /* ** Modules ** */ #include "irresistible\cnr\commands\admin\admin_one.pwn" #include "irresistible\cnr\commands\admin\admin_two.pwn" diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn index 7c0ae98..e7d751c 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_one.pwn @@ -714,3 +714,31 @@ CMD:mutelist( playerid, params[ ] ) else return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Muted List", szNormalString, "Close", "" ), 1; } + +CMD:chatbanlist( playerid, params[ ] ) +{ + new + count = 0; + + if ( p_AdminLevel[ playerid ] < 1 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + + szNormalString[ 0 ] = '\0'; + foreach( new i : Player ) + { + if ( p_ChatBanned{ i } ) + { + format( szNormalString, sizeof( szNormalString ), "%s"COL_WHITE"%s(%d)\t"COL_GREY"By %s for '%s'\n", + szNormalString, + ReturnPlayerName( i ), i, + p_ChatBannedBy[ playerid ], + p_ChatBanReason[ playerid ] + ); + + count ++; + } + } + if ( count == 0 ) + return SendError( playerid, "There are no chat banned players online." ); + else + return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Chat Ban List", szNormalString, "Close", "" ), 1; +} \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn index e01717f..d3a63af 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_three.pwn @@ -6,40 +6,6 @@ */ /* ** Commands ** */ -CMD:smlog( playerid, params[ ] ) -{ - new - pID - ; - - if ( p_AdminLevel[ playerid ] < 2 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/smlog [PLAYER_ID]" ); - else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); - else - { - format( szBigString, 160, "SELECT u.`NAME`,t.`CASH`,t.`DATE` FROM `TRANSACTIONS` t INNER JOIN `USERS` u ON t.`TO_ID`=u.`ID` WHERE FROM_ID=%d ORDER BY DATE DESC LIMIT 10", p_AccountID[ pID ] ); - mysql_function_query( dbHandle, szBigString, true, "readmoneylog", "dd", playerid, pID ); - } - return 1; -} - -CMD:iclog( playerid, params[ ] ) -{ - new - pID - ; - - if ( p_AdminLevel[ playerid ] < 2 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/iclog [PLAYER_ID]" ); - else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); - else - { - format( szBigString, 160, "SELECT u.`NAME`,t.`IC`,t.`DATE` FROM `TRANSACTIONS_IC` t INNER JOIN `USERS` u ON t.`TO_ID`=u.`ID` WHERE FROM_ID=%d ORDER BY DATE DESC LIMIT 10", p_AccountID[ pID ] ); - mysql_function_query( dbHandle, szBigString, true, "readiclog", "dd", playerid, pID ); - } - return 1; -} - CMD:resetwep( playerid, params[ ] ) { new @@ -622,9 +588,9 @@ CMD:forceac( playerid, params[ ] ) pID; if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); - else if ( sscanf( params, "u", pID ) ) SendUsage( playerid, "/forceac [PLAYER_ID]" ); + else if ( sscanf( params, "u", pID ) ) return 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 use this command on yourself." ); + else if ( pID == playerid ) return SendError( playerid, "You can't 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 @@ -643,4 +609,75 @@ CMD:forceac( playerid, params[ ] ) } } return 1; +} + +CMD:chatban( playerid, params[ ] ) +{ + + new pID, reason[ 25 ]; + + if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + else if ( sscanf( params, "us[50]", pID, reason ) ) return SendUsage( playerid, "/chatban [PLAYER_ID] [REASON]" ); + else if ( strlen( reason ) < 3 || strlen( reason ) > 25 ) return SendError( playerid, "Please keep your chat ban reason between 3 - 25 characters." ); + else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); + else if ( pID == playerid ) return SendError( playerid, "You can't 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 ( IsPlayerChatBanned( pID ) ) return SendError( playerid, "This player is already chat banned." ); + else + { + p_ChatBanned{ pID } = true; + p_ChatBannedBy[ pID ] = ReturnPlayerName( playerid ); + p_ChatBanReason[ pID ] = reason; + mysql_single_query( sprintf( "INSERT INTO `CHAT_BANS` (`ID`, `NAME`, `BANNED_BY_ID`, `BANNED_BY`, `REASON`) VALUES (%d, '%s', %d, '%s', '%s')", p_AccountID[ pID ], mysql_escape( ReturnPlayerName( pID ) ), p_AccountID[ playerid ], mysql_escape( ReturnPlayerName( playerid ) ), mysql_escape( reason ) ) ); + SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have been chat banned by %s for '%s'.", ReturnPlayerName( pID ), reason ); + AddAdminLogLineFormatted( "%s(%d) has chat banned %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID ); + SaveToAdminLog( playerid, p_AccountID[ pID ], "chat ban" ); + } + + return 1; +} + +CMD:unchatban( playerid, params[ ] ) +{ + + new pID; + + if ( p_AdminLevel[ playerid ] < 3 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/chatban [PLAYER_ID]" ); + else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); + else if ( pID == playerid ) return SendError( playerid, "You can't use this command on yourself." ); + else if ( !IsPlayerChatBanned( pID ) ) return SendError( playerid, "This player is not chat banned." ); + else + { + p_ChatBanned{ pID } = false; + mysql_single_query( sprintf( "DELETE FROM `CHAT_BANS` WHERE `ID`=%d", p_AccountID[ pID ] ) ); + SendClientMessageFormatted( playerid, -1, ""COL_PINK"[ADMIN]"COL_WHITE" You have been chat unbanned by %s.", ReturnPlayerName( pID ) ); + AddAdminLogLineFormatted( "%s(%d) has chat unbanned %s(%d)", ReturnPlayerName( playerid ), playerid, ReturnPlayerName( pID ), pID ); + SaveToAdminLog( playerid, p_AccountID[ pID ], "chat unban" ); + } + + return 1; + +} + +thread ChatBanUponLogin( playerid ) +{ + new + rows, fields + ; + cache_get_data( rows, fields ); + + if ( rows ) + { + new banned_by[ MAX_PLAYER_NAME ], reason[ 25 ]; + + cache_get_field_content( 0, "BANNED_BY", banned_by ); + cache_get_field_content( 0, "REASON", reason ); + + p_ChatBanned{ playerid } = true; + p_ChatBannedBy[ playerid ] = banned_by; + p_ChatBanReason[ playerid ] = reason; + print("done with chatbanuponlogin"); + } + return 1; } \ No newline at end of file diff --git a/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn b/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn index 5921793..715fbcd 100644 --- a/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn +++ b/gamemodes/irresistible/cnr/commands/admin/admin_two.pwn @@ -6,6 +6,40 @@ */ /* ** Commands ** */ +CMD:smlog( playerid, params[ ] ) +{ + new + pID + ; + + if ( p_AdminLevel[ playerid ] < 2 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/smlog [PLAYER_ID]" ); + else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); + else + { + format( szBigString, 160, "SELECT u.`NAME`,t.`CASH`,t.`DATE` FROM `TRANSACTIONS` t INNER JOIN `USERS` u ON t.`TO_ID`=u.`ID` WHERE FROM_ID=%d ORDER BY DATE DESC LIMIT 10", p_AccountID[ pID ] ); + mysql_function_query( dbHandle, szBigString, true, "readmoneylog", "dd", playerid, pID ); + } + return 1; +} + +CMD:iclog( playerid, params[ ] ) +{ + new + pID + ; + + if ( p_AdminLevel[ playerid ] < 2 ) return SendError( playerid, ADMIN_COMMAND_REJECT ); + else if ( sscanf( params, "u", pID ) ) return SendUsage( playerid, "/iclog [PLAYER_ID]" ); + else if ( !IsPlayerConnected( pID ) || IsPlayerNPC( pID ) ) return SendError( playerid, "Invalid Player ID." ); + else + { + format( szBigString, 160, "SELECT u.`NAME`,t.`IC`,t.`DATE` FROM `TRANSACTIONS_IC` t INNER JOIN `USERS` u ON t.`TO_ID`=u.`ID` WHERE FROM_ID=%d ORDER BY DATE DESC LIMIT 10", p_AccountID[ pID ] ); + mysql_function_query( dbHandle, szBigString, true, "readiclog", "dd", playerid, pID ); + } + return 1; +} + CMD:slay( playerid, params[ ] ) { new diff --git a/gamemodes/irresistible/cnr/player.pwn b/gamemodes/irresistible/cnr/player.pwn index 88f36fe..142fbdc 100644 --- a/gamemodes/irresistible/cnr/player.pwn +++ b/gamemodes/irresistible/cnr/player.pwn @@ -52,6 +52,9 @@ new // p_XP [ MAX_PLAYERS ], bool: p_Spectating [ MAX_PLAYERS char ], bool: p_Muted [ MAX_PLAYERS char ], + bool: p_ChatBanned [ MAX_PLAYERS char ], + p_ChatBannedBy [ MAX_PLAYERS ] [ MAX_PLAYER_NAME ], + p_ChatBanReason [ MAX_PLAYERS ] [ 25 ], bool: p_InfectedHIV [ MAX_PLAYERS char ], p_AntiTextSpam [ MAX_PLAYERS ], bool: p_BlockedPM [ MAX_PLAYERS ] [ MAX_PLAYERS ], @@ -218,3 +221,5 @@ stock IsPlayerSpawned( playerid ) return p_Spawned{ playerid }; stock IsPlayerJailed( playerid ) return p_Jailed{ playerid }; stock IsPlayerAdminOnDuty( playerid ) return p_AdminOnDuty{ playerid }; + +stock IsPlayerChatBanned( playerid ) return p_ChatBanned{ playerid }; \ No newline at end of file diff --git a/gamemodes/irresistible/config/migrations/cnr/20190405_cnr_chat_ban_creation b/gamemodes/irresistible/config/migrations/cnr/20190405_cnr_chat_ban_creation new file mode 100644 index 0000000..697b008 --- /dev/null +++ b/gamemodes/irresistible/config/migrations/cnr/20190405_cnr_chat_ban_creation @@ -0,0 +1,14 @@ +-- CREATE A MIGRATION ENTRY +INSERT INTO `DB_MIGRATIONS` (`MIGRATION`) VALUES ('20190405_cnr_chat_ban_creation'); + +--BEGIN + +-- CREATE TABLE +CREATE TABLE IF NOT EXISTS `CHAT_BANS` ( + `ID` int(11) NOT NULL, + `NAME` varchar(25) DEFAULT NULL, + `BANNED_BY_ID` int(11) NOT NULL, + `BANNED_BY` varchar(25) DEFAULT NULL, + `REASON` varchar(25) DEFAULT NULL, + UNIQUE KEY `ID` (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index c11dbb3..f66a3bb 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -521,6 +521,9 @@ public OnPlayerDisconnect( playerid, reason ) p_Cuffed { playerid } = false; justConnected { playerid } = true; p_Muted { playerid } = false; + p_ChatBanned { playerid } = false; + p_ChatBannedBy [ playerid ] [ 0 ] = '\0'; + p_ChatBanReason [ playerid ] [ 0 ] = '\0'; p_MetalMelter [ playerid ] = 0; p_LeftCuffed { playerid } = false; p_PmResponder [ playerid ] = INVALID_PLAYER_ID; @@ -1508,12 +1511,15 @@ public OnPlayerText( playerid, text[ ] ) return SendError( playerid, "An error occured, please try again." ), 0; #endif + if ( IsPlayerChatBanned( playerid ) ) + return SendError( playerid, "You have been chat banned and are not allowed to chat."), 0; + if ( textContainsIP( text ) ) return SendServerMessage( playerid, "Please do not advertise." ), 0; new tick_count = GetTickCount( ); - if ( p_AntiTextSpam[ playerid ] > tick_count ) + if ( p_AntiTextSpam[ playerid ] > tick_count && p_AdminLevel[ playerid ] != 6 ) { p_AntiTextSpam[ playerid ] = tick_count + 750; p_AntiTextSpamCount{ playerid } ++; @@ -2105,7 +2111,8 @@ CMD:cw( playerid, params[ ] ) return cmd_carwhisper( playerid, params ); CMD:carwhisper( playerid, params[ ] ) { new msg[ 100 ]; - if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." ); + if ( p_ChatBanned{ playerid } ) return SendError( playerid, "You have been chat banned and are not allowed to chat." ); + else if ( !IsPlayerInAnyVehicle( playerid ) ) return SendError( playerid, "You must be inside a vehicle to use this command." ); else if ( sscanf( params, "s[100]", msg ) ) return SendUsage( playerid, "/carwhisper [MESSAGE]" ); else if ( textContainsIP( msg ) ) return SendError( playerid, "Advertising is forbidden." ); else @@ -2124,7 +2131,8 @@ CMD:w( playerid, params[ ] ) return cmd_whisper( playerid, params ); CMD:whisper( playerid, params[ ] ) { new msg[ 100 ]; - if ( sscanf( params, "s[100]", msg ) ) return SendUsage( playerid, "/whisper [MESSAGE]" ); + if ( p_ChatBanned{ playerid } ) return SendError( playerid, "You have been chat banned and are not allowed to chat." ); + else if ( sscanf( params, "s[100]", msg ) ) return SendUsage( playerid, "/whisper [MESSAGE]" ); else if ( textContainsIP( msg ) ) return SendError( playerid, "Advertising is forbidden." ); else { diff --git a/scriptfiles/changelogs/cnr/v11.54.157.txt b/scriptfiles/changelogs/cnr/v11.54.157.txt new file mode 100644 index 0000000..bdc7eaa --- /dev/null +++ b/scriptfiles/changelogs/cnr/v11.54.157.txt @@ -0,0 +1,4 @@ +(+) Adds /(demp)disableemp to reinitialize a recently EMP'd vehicle. +(+) Adds /(un)chatban to ban low quality members from chat instead of banning. +(+) Adds /chatbanlist to view all online chat banned members. +(*) Moved /smlog and /iclog for admins into their correct level section of /acmds. \ No newline at end of file