cannon bug fixes

This commit is contained in:
Lorenc Pekaj 2018-07-06 10:01:41 +10:00
parent d71f2da099
commit 6f540ffb3f
2 changed files with 16 additions and 10 deletions

View File

@ -84,6 +84,16 @@ hook OnPlayerDisconnect( playerid, reason )
return 1; return 1;
} }
#if defined AC_INCLUDED
hook OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
#else
hook OnPlayerDeath(playerid, killerid, reason)
#endif
{
ClosePlayerOrbitalCannon( playerid );
return 1;
}
/* ** Callbacks ** */ /* ** Callbacks ** */
function OnPlayerOrbitalCannonUpdate( facilityid, playerid ) function OnPlayerOrbitalCannonUpdate( facilityid, playerid )
{ {
@ -99,9 +109,11 @@ function OnPlayerOrbitalCannonUpdate( facilityid, playerid )
MapAndreas_FindZ_For2DCoord( current_pos[ 0 ], current_pos[ 1 ], current_pos[ 2 ] ); MapAndreas_FindZ_For2DCoord( current_pos[ 0 ], current_pos[ 1 ], current_pos[ 2 ] );
// close // close
if ( ( keys & KEY_CROUCH ) || IsPlayerJailed( playerid ) || IsPlayerAFK( playerid ) ) if ( ( keys & KEY_CROUCH ) || IsPlayerJailed( playerid ) || IsPlayerAFK( playerid ) || ( GetPlayerCash( playerid ) < 250000 && ! g_orbitalCannonData[ facilityid ] [ E_COOL_DOWN ] ) )
{ {
SetPVarInt( playerid, "left_cannon", facilityid ); SetPVarInt( playerid, "left_cannon", facilityid );
HidePlayerHelpDialog( playerid );
if ( IsPlayerMovieMode( playerid ) ) cmd_moviemode( playerid, "" );
ClosePlayerOrbitalCannon( playerid ); ClosePlayerOrbitalCannon( playerid );
return TogglePlayerSpectating( playerid, 0 ); return TogglePlayerSpectating( playerid, 0 );
} }
@ -109,13 +121,6 @@ function OnPlayerOrbitalCannonUpdate( facilityid, playerid )
// fire ammo // fire ammo
if ( ( keys & KEY_SPRINT ) && ! g_orbitalCannonData[ facilityid ] [ E_COOL_DOWN ] ) if ( ( keys & KEY_SPRINT ) && ! g_orbitalCannonData[ facilityid ] [ E_COOL_DOWN ] )
{ {
if ( GetPlayerCash( playerid ) < 250000 ) {
SetPVarInt( playerid, "left_cannon", facilityid );
ClosePlayerOrbitalCannon( playerid );
TogglePlayerSpectating( playerid, 0 );
return SendError( playerid, "You need $250,000 to fire an orbital cannon." );
}
// add tick (ms) for countdown // add tick (ms) for countdown
g_orbitalCannonData[ facilityid ] [ E_FIRE_TICK ] += ORBITAL_CANNON_TICK; g_orbitalCannonData[ facilityid ] [ E_FIRE_TICK ] += ORBITAL_CANNON_TICK;
@ -339,8 +344,6 @@ stock ClosePlayerOrbitalCannon( playerid ) {
// remove user // remove user
p_usingOrbitalCannon[ playerid ] = -1; p_usingOrbitalCannon[ playerid ] = -1;
TextDrawHideForPlayer( playerid, g_orbitalAimTD ); TextDrawHideForPlayer( playerid, g_orbitalAimTD );
HidePlayerHelpDialog( playerid );
if ( IsPlayerMovieMode( playerid ) ) cmd_moviemode( playerid, "" );
// reset facility portion // reset facility portion
if ( 0 <= facilityid < sizeof( g_orbitalCannonData ) ) if ( 0 <= facilityid < sizeof( g_orbitalCannonData ) )

View File

@ -158,6 +158,9 @@ hook OnPlayerEnterDynamicCP( playerid, checkpointid )
if ( GetPlayerCash( playerid ) < 250000 ) if ( GetPlayerCash( playerid ) < 250000 )
return SendError( playerid, "You need at least $250,000 available to begin operating the orbital cannon." ); return SendError( playerid, "You need at least $250,000 available to begin operating the orbital cannon." );
if ( GetPlayerClass( playerid ) != CLASS_CIVILIAN )
return SendError( playerid, "You must be a civilian to use this feature." );
if ( StartPlayerOrbitalCannon( playerid, facility ) ) if ( StartPlayerOrbitalCannon( playerid, facility ) )
{ {
return SendServerMessage( playerid, "You are now operating this facility's orbital cannon." ); return SendServerMessage( playerid, "You are now operating this facility's orbital cannon." );