vending machine bug fix

This commit is contained in:
Lorenc Pekaj 2018-09-11 07:58:33 +10:00
parent 4df1a7561d
commit 97b129e2fe

View File

@ -122,7 +122,7 @@ hook OnPlayerConnect( playerid )
hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{ {
if ( ( ( ( newkeys & KEY_SECONDARY_ATTACK ) == KEY_SECONDARY_ATTACK ) && ( ( oldkeys & KEY_SECONDARY_ATTACK ) != KEY_SECONDARY_ATTACK ) ) ) // pressed ENTER if ( 0 <= playerid < MAX_PLAYERS && ( ( ( newkeys & KEY_SECONDARY_ATTACK ) == KEY_SECONDARY_ATTACK ) && ( ( oldkeys & KEY_SECONDARY_ATTACK ) != KEY_SECONDARY_ATTACK ) ) ) // pressed ENTER
{ {
if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT && p_VendingUseTimer[ playerid ] == -1 && GetPlayerAnimationIndex( playerid ) != 1660 ) if ( GetPlayerState( playerid ) == PLAYER_STATE_ONFOOT && p_VendingUseTimer[ playerid ] == -1 && GetPlayerAnimationIndex( playerid ) != 1660 )
{ {
@ -221,7 +221,7 @@ public VendingMachineUsed( playerid, Float: fHealthGiven )
/* ** Functions ** */ /* ** Functions ** */
stock ResetPlayerVendingMachineData( playerid ) stock ResetPlayerVendingMachineData( playerid )
{ {
if ( p_VendingUseTimer[ playerid ] != -1 ) if ( 0 <= playerid < MAX_PLAYERS && p_VendingUseTimer[ playerid ] != -1 )
{ {
KillTimer( p_VendingUseTimer[ playerid ] ); KillTimer( p_VendingUseTimer[ playerid ] );
p_VendingUseTimer[ playerid ] = -1; p_VendingUseTimer[ playerid ] = -1;