fix safe bug

applyanimation sometimes is not working. it makes safe bug if players are not near safe
This commit is contained in:
Pichai Lertwachirakul 2022-05-01 23:31:45 +07:00 committed by GitHub
parent 19400a4a08
commit 1ed11d8424
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -228,8 +228,15 @@ hook OnProgressCompleted( playerid, progressid, params )
Float: distance = distanceFromSafe( playerid, robberyid )
;
if ( robberyid != -1 && 0.0 < distance <= 2.5 )
if ( robberyid != -1 )
{
if ( !( 0.0 < distance <= 2.5 )) {
// applyanimation sometimes is not working. they can move out. just revert safe and players' state.
RemovePlayerAttachedObject( playerid, 0 );
g_robberyData [ params ] [ E_STATE ] = STATE_NONE;
p_UsingRobberySafe [ playerid ] = -1;
return 1;
}
if ( !g_robberyData[ robberyid ] [ E_ROBBED ] && !IsValidDynamicObject( g_robberyData[ robberyid ] [ E_SAFE_MONEY ] ) )
{
static
@ -910,4 +917,4 @@ stock GetPlayerDrillStrength( playerid ) return p_drillStrength[ playerid ];
stock SetPlayerDrillStrength( playerid, strength ) {
p_drillStrength[ playerid ] = strength;
}
}