pool issue with exiting table while not even in it, fixed

This commit is contained in:
Lorenc Pekaj 2018-09-17 18:30:14 +10:00
parent e493eca59e
commit 9f81391323
2 changed files with 8 additions and 2 deletions

View File

@ -247,7 +247,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
if ( g_poolTableData[ poolid ] [ E_STARTED ] ) if ( g_poolTableData[ poolid ] [ E_STARTED ] )
{ {
// quit table // quit table
if ( HOLDING( KEY_SECONDARY_ATTACK ) ) { if ( HOLDING( KEY_SECONDARY_ATTACK ) && IsPlayerPlayingPool( playerid ) ) {
if ( PRESSED( KEY_CROUCH ) ) { if ( PRESSED( KEY_CROUCH ) ) {
HidePlayerHelpDialog( playerid ); HidePlayerHelpDialog( playerid );
Pool_SendTableMessage( poolid, COLOR_GREY, "-- "COL_WHITE" %s(%d) has left the table", ReturnPlayerName( playerid ), playerid ); Pool_SendTableMessage( poolid, COLOR_GREY, "-- "COL_WHITE" %s(%d) has left the table", ReturnPlayerName( playerid ), playerid );
@ -260,6 +260,7 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
// make pressing key fire annoying // make pressing key fire annoying
if ( RELEASED( KEY_FIRE ) && g_poolTableData[ poolid ] [ E_AIMER ] != playerid && ! p_PoolChalking{ playerid } ) if ( RELEASED( KEY_FIRE ) && g_poolTableData[ poolid ] [ E_AIMER ] != playerid && ! p_PoolChalking{ playerid } )
{ {
// reset anims of player
if ( IsPlayerPlayingPool( playerid ) ) if ( IsPlayerPlayingPool( playerid ) )
{ {
p_PoolChalking{ playerid } = true; p_PoolChalking{ playerid } = true;
@ -275,6 +276,11 @@ hook OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{ {
ClearAnimations( playerid ); ClearAnimations( playerid );
} }
// reset ball positions just in-case they hit it
if ( Pool_AreBallsStopped( poolid ) ) {
Pool_ResetBallPositions( poolid );
}
return 1; return 1;
} }

View File

@ -16,7 +16,7 @@
#pragma option -d3 #pragma option -d3
#pragma dynamic 7200000 #pragma dynamic 7200000
#define DEBUG_MODE //#define DEBUG_MODE
#if defined DEBUG_MODE #if defined DEBUG_MODE
#pragma option -d3 #pragma option -d3