From 9b3f6f91c79bdc7934bc60b7814c7aee27cdb94e Mon Sep 17 00:00:00 2001 From: Stev Date: Mon, 14 Jan 2019 19:54:57 +0000 Subject: [PATCH] removing breakcuff code from main into arrest module --- .../irresistible/cnr/features/cop/arrest.pwn | 8 +++ gamemodes/sf-cnr.pwn | 58 ------------------- 2 files changed, 8 insertions(+), 58 deletions(-) diff --git a/gamemodes/irresistible/cnr/features/cop/arrest.pwn b/gamemodes/irresistible/cnr/features/cop/arrest.pwn index 3fb1170..75cfd61 100644 --- a/gamemodes/irresistible/cnr/features/cop/arrest.pwn +++ b/gamemodes/irresistible/cnr/features/cop/arrest.pwn @@ -26,6 +26,14 @@ hook OnPlayerDisconnect( playerid, reason ) return 1; } +hook OnPlayerSpawn( playerid ) +{ + p_AwaitingBCAttempt{ playerid } = false; + KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); + p_AwaitingBCAttemptTimer[ playerid ] = -1; + return 1; +} + #if defined AC_INCLUDED hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart ) #else diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index 00a6d54..feebb82 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -515,7 +515,6 @@ public OnPlayerDisconnect( playerid, reason ) p_AntiEMP [ playerid ] = 0; p_LastVehicle [ playerid ] = INVALID_VEHICLE_ID; p_Cuffed { playerid } = false; - p_AwaitingBCAttempt[ playerid ] = false; justConnected { playerid } = true; p_Muted { playerid } = false; p_MetalMelter [ playerid ] = 0; @@ -594,7 +593,6 @@ public OnPlayerDisconnect( playerid, reason ) DestroyAllPlayerC4s( playerid, true ); KillTimer( p_JailTimer[ playerid ] ); KillTimer( p_CuffAbuseTimer[ playerid ] ); - KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); ResetPlayerCash( playerid ); if ( !GetPVarInt( playerid, "banned_connection" ) ) SendDeathMessage( INVALID_PLAYER_ID, playerid, 201 ); @@ -666,8 +664,6 @@ public OnPlayerSpawn( playerid ) StopSound( playerid ); CancelEdit( playerid ); HidePlayerHelpDialog( playerid ); - - KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); // Money Bags if ( p_MoneyBag{ playerid } && p_Class[ playerid ] != CLASS_POLICE ) // SetPlayerAttachedObject( playerid, 1, 1550, 1, 0.131999, -0.140999, 0.053999, 11.299997, 65.599906, 173.900054, 0.652000, 0.573000, 0.594000 ); @@ -1198,7 +1194,6 @@ public OnPlayerDeath( playerid, killerid, reason ) RemovePlayerStolensFromHands( playerid ); RemoveEquippedOre( playerid ); KillTimer( p_CuffAbuseTimer[ playerid ] ); - KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); PlayerTextDrawHide( playerid, p_LocationTD[ playerid ] ); p_Tazed{ playerid } = false; p_WeaponDealing{ playerid } = false; @@ -7107,59 +7102,6 @@ stock ShowPlayerSpawnMenu( playerid ) { return ShowPlayerDialog( playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST, "{FFFFFF}Spawn Location", ""COL_GREY"Reset Back To Default\nHouse\nBusiness\nGang Facility\nVisage Casino", "Select", "Cancel" ); } -stock BreakPlayerCuffs( playerid ) -{ - if ( !IsPlayerConnected( playerid ) ) return false; - - if ( p_BobbyPins[ playerid ] < 1 ) - { - ShowPlayerHelpDialog( playerid, 4000, "You can buy bobby pins at Supa Save or a 24/7 store to break cuffs." ); - return false; - } - else p_BobbyPins[ playerid ]--; - - if ( p_AwaitingBCAttempt[ playerid ] ) p_AwaitingBCAttempt[ playerid ] = false; - - new probability = 60; - - if ( random( 101 ) <= probability ) - { - if ( !IsPlayerCuffed( playerid ) ) - { - Untaze( playerid, 10 ); - GivePlayerWantedLevel( playerid, 6 ); - } - else - { - if ( !IsPlayerAttachedObjectSlotUsed( playerid, 2 ) ) - return false; - - TogglePlayerControllable( playerid, 1 ); - RemovePlayerAttachedObject( playerid, 2 ); - SetPlayerSpecialAction( playerid, SPECIAL_ACTION_NONE ); - - if ( !IsPlayerInAnyVehicle( playerid ) ) { - ClearAnimations( playerid ); - } - - p_Cuffed{ playerid } = false; - p_BulletInvulnerbility[ playerid ] = g_iTime + 5; - } - SendServerMessage( playerid, "You have successfully broken out of your cuffs!" ); - return true; - } - else - { - SendServerMessage( playerid, "You have snapped your bobby pin and failed to break out of your cuffs. Re-attempting in 3 seconds." ); - p_AwaitingBCAttempt[ playerid ] = true; - KillTimer( p_AwaitingBCAttemptTimer[ playerid ] ); - p_AwaitingBCAttemptTimer[ playerid ] = SetTimerEx( "BreakPlayerCuffsAttempt", 3000, false, "d", playerid ); - return false; - } -} - -function BreakPlayerCuffsAttempt( playerid ) return BreakPlayerCuffs( playerid ); - stock IsPlayerAFK( playerid ) return ( ( GetTickCount( ) - p_AFKTime[ playerid ] ) >= 2595 ); stock GetPlayerVIPDuration( playerid ) return p_VIPExpiretime[ playerid ] - g_iTime;