From ea2cda97d3f4bd0a0ba6469a0555ecee027a1a79 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 14:44:36 +0300 Subject: [PATCH 1/8] Ignores "quit to avoid" if player is in event --- gamemodes/sf-cnr.pwn | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 061821b..f2158d2 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -845,8 +845,12 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: return 1; // fcnpc // Cop shoots innocent, they /q - so jail + #if defined __cloudy_event_system + if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 && ! IsPlayerInEvent( playerid ) && ! IsPlayerInEvent( hitid ) ) + #else if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 ) p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3; + #endif if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ hitid ] != CLASS_POLICE && !p_WantedLevel[ hitid ] && GetPlayerState( hitid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( playerid ) && ! IsPlayerInBattleRoyale( playerid ) ) return ShowPlayerHelpDialog( playerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0; From ca9af55c370ee28153e4119050931344eb295e21 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 14:48:04 +0300 Subject: [PATCH 2/8] Update sf-cnr.pwn --- gamemodes/sf-cnr.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index f2158d2..30a5d82 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -849,8 +849,8 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 && ! IsPlayerInEvent( playerid ) && ! IsPlayerInEvent( hitid ) ) #else if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 ) - p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3; #endif + p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3; if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ hitid ] != CLASS_POLICE && !p_WantedLevel[ hitid ] && GetPlayerState( hitid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( playerid ) && ! IsPlayerInBattleRoyale( playerid ) ) return ShowPlayerHelpDialog( playerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0; From 80b252e9fbc2dfa7919c2d6e40fe15f5d5fc89a4 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 14:50:15 +0300 Subject: [PATCH 3/8] Fixes player quit to avoid No longer awards nearest cop is criminal is in event --- gamemodes/irresistible/cnr/features/cop/arrest.pwn | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index 794754a..309c2bb 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -437,7 +437,11 @@ stock BreakPlayerCuffs( playerid ) stock AwardNearestLEO( playerid, reason ) { - if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || IsPlayerDead( playerid ) ) + #if defined __cloudy_event_system + if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || ReturnPlayerHealth( playerid ) <= 0 || IsPlayerInEvent( playerid ) ) + #else + if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || ReturnPlayerHealth( playerid ) <= 0 ) + #endif return false; new Float: radius = ( IsPlayerInAnyVehicle( playerid ) ? 150.0 : 75.0 ); // If player is in a vehicle, increase radius due to ability to get farther quicker. @@ -500,4 +504,4 @@ hook OnPlayerUpdateEx( playerid ) } } return 1; -} \ No newline at end of file +} From eb318f0467128e6419c4d930cdd4d11fce886597 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 15:03:19 +0300 Subject: [PATCH 4/8] Event system related Criminals who engage with cops then leave the game are no longer considered quitting to avoid. --- gamemodes/irresistible/cnr/auth/account.pwn | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/auth/account.pwn b/gamemodes/irresistible/cnr/auth/account.pwn index ee6c95f..513f600 100644 --- a/gamemodes/irresistible/cnr/auth/account.pwn +++ b/gamemodes/irresistible/cnr/auth/account.pwn @@ -373,7 +373,11 @@ stock SavePlayerData( playerid, bool: logout = false ) new bool: bQuitToAvoid = false; + #if defined __cloudy_event_system + if ( ( IsPlayerCuffed( playerid ) || IsPlayerTazed( playerid ) || IsPlayerTied( playerid ) || p_LeftCuffed{ playerid } || p_QuitToAvoidTimestamp[ playerid ] > g_iTime ) && ! IsPlayerInEvent( playerid ) ) + #else if ( IsPlayerCuffed( playerid ) || IsPlayerTazed( playerid ) || IsPlayerTied( playerid ) || p_LeftCuffed{ playerid } || p_QuitToAvoidTimestamp[ playerid ] > g_iTime ) + #endif bQuitToAvoid = true; format( Query, sizeof( Query ), "UPDATE `USERS` SET `SCORE`=%d,`ADMINLEVEL`=%d,`OWNEDHOUSES`=%d,`KILLS`=%d,`DEATHS`=%d,`VIP_PACKAGE`=%d,`OWNEDCARS`=%d,`LASTLOGGED`=%d,`VIP_EXPIRE`=%d,`LAST_SKIN`=%d,`BURGLARIES`=%d,`UPTIME`=%d,`ARRESTS`=%d,`CITY`=%d,`METH`=%d,`SODA`=%d,`ACID`=%d,`GAS`=%d,", @@ -415,4 +419,4 @@ stock SavePlayerData( playerid, bool: logout = false ) stock GetPlayerAccountID( playerid ) return p_AccountID[ playerid ]; -stock IsPlayerLoggedIn( playerid ) return p_PlayerLogged{ playerid }; \ No newline at end of file +stock IsPlayerLoggedIn( playerid ) return p_PlayerLogged{ playerid }; From 5a750d91e9a1b85efa857e9831a75d9780a59a64 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 15:16:44 +0300 Subject: [PATCH 5/8] Update account.pwn --- gamemodes/irresistible/cnr/auth/account.pwn | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gamemodes/irresistible/cnr/auth/account.pwn b/gamemodes/irresistible/cnr/auth/account.pwn index 513f600..908b75f 100644 --- a/gamemodes/irresistible/cnr/auth/account.pwn +++ b/gamemodes/irresistible/cnr/auth/account.pwn @@ -373,12 +373,13 @@ stock SavePlayerData( playerid, bool: logout = false ) new bool: bQuitToAvoid = false; - #if defined __cloudy_event_system - if ( ( IsPlayerCuffed( playerid ) || IsPlayerTazed( playerid ) || IsPlayerTied( playerid ) || p_LeftCuffed{ playerid } || p_QuitToAvoidTimestamp[ playerid ] > g_iTime ) && ! IsPlayerInEvent( playerid ) ) - #else if ( IsPlayerCuffed( playerid ) || IsPlayerTazed( playerid ) || IsPlayerTied( playerid ) || p_LeftCuffed{ playerid } || p_QuitToAvoidTimestamp[ playerid ] > g_iTime ) - #endif bQuitToAvoid = true; + + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) ) + bQuitToAvoid = false; + #endif format( Query, sizeof( Query ), "UPDATE `USERS` SET `SCORE`=%d,`ADMINLEVEL`=%d,`OWNEDHOUSES`=%d,`KILLS`=%d,`DEATHS`=%d,`VIP_PACKAGE`=%d,`OWNEDCARS`=%d,`LASTLOGGED`=%d,`VIP_EXPIRE`=%d,`LAST_SKIN`=%d,`BURGLARIES`=%d,`UPTIME`=%d,`ARRESTS`=%d,`CITY`=%d,`METH`=%d,`SODA`=%d,`ACID`=%d,`GAS`=%d,", GetPlayerScore( playerid ), p_AdminLevel[ playerid ], From 928e6fba7b6337ba9e13cd9e775e1db4d7fef8e0 Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 15:20:49 +0300 Subject: [PATCH 6/8] Update arrest.pwn --- gamemodes/irresistible/cnr/features/cop/arrest.pwn | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index 309c2bb..fb79a6d 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -437,13 +437,14 @@ stock BreakPlayerCuffs( playerid ) stock AwardNearestLEO( playerid, reason ) { - #if defined __cloudy_event_system - if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || ReturnPlayerHealth( playerid ) <= 0 || IsPlayerInEvent( playerid ) ) - #else if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || ReturnPlayerHealth( playerid ) <= 0 ) - #endif return false; - + + #if defined __cloudy_event_system + if ( IsPlayerInEvent( playerid ) ) + return false; + #endif + new Float: radius = ( IsPlayerInAnyVehicle( playerid ) ? 150.0 : 75.0 ); // If player is in a vehicle, increase radius due to ability to get farther quicker. new closestLEO = GetClosestPlayerEx( playerid, CLASS_POLICE, radius ); From f0e46849bf05b2511c54134acb6280586dd45c8e Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 15:22:53 +0300 Subject: [PATCH 7/8] Update sf-cnr.pwn --- gamemodes/sf-cnr.pwn | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 30a5d82..3298fe4 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -850,7 +850,9 @@ public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: #else if ( p_Class[ playerid ] == CLASS_POLICE && p_WantedLevel[ hitid ] > 2 ) #endif + { p_QuitToAvoidTimestamp[ hitid ] = g_iTime + 3; + } if ( p_Class[ playerid ] == CLASS_POLICE && p_Class[ hitid ] != CLASS_POLICE && !p_WantedLevel[ hitid ] && GetPlayerState( hitid ) != PLAYER_STATE_WASTED && ! IsPlayerInEvent( playerid ) && ! IsPlayerInBattleRoyale( playerid ) ) return ShowPlayerHelpDialog( playerid, 2000, "You cannot hurt innocent civilians, you're a ~b~cop~w~~h~!" ), 0; From de946d243fce037876e56d2103b192766bc7ee5c Mon Sep 17 00:00:00 2001 From: Cloudy <36423427+meCloudy@users.noreply.github.com> Date: Sun, 2 Jun 2019 15:26:38 +0300 Subject: [PATCH 8/8] Update arrest.pwn --- gamemodes/irresistible/cnr/features/cop/arrest.pwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index fb79a6d..36e56f9 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -437,7 +437,7 @@ stock BreakPlayerCuffs( playerid ) stock AwardNearestLEO( playerid, reason ) { - if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || ReturnPlayerHealth( playerid ) <= 0 ) + if ( ! IsPlayerConnected( playerid ) || playerid == INVALID_PLAYER_ID || GetPlayerWantedLevel( playerid ) < 2 || IsPlayerDead( playerid ) ) return false; #if defined __cloudy_event_system