removing breakcuff code from main into arrest module

This commit is contained in:
Stev 2019-01-14 19:54:57 +00:00
parent 001c387cfb
commit 9b3f6f91c7
2 changed files with 8 additions and 58 deletions

View File

@ -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

View File

@ -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;