remove players that are removed from their vehicle

This commit is contained in:
Lorenc Pekaj 2018-11-24 04:59:38 +11:00
parent 455b728258
commit 5351647f95

View File

@ -89,7 +89,9 @@ hook OnPlayerEnterDynArea( playerid, areaid )
return 1; return 1;
} }
hook OnPlayerExitVehicle( playerid, vehicleid ) hook OnPlayerStateChange( playerid, newstate, oldstate )
{
if ( newstate != PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_DRIVER )
{ {
new new
iRace = p_raceLobbyId[ playerid ]; iRace = p_raceLobbyId[ playerid ];
@ -99,6 +101,7 @@ hook OnPlayerExitVehicle( playerid, vehicleid )
SendClientMessageToRace( iRace, COLOR_GREY, "[RACE]"COL_WHITE" %s(%d) has exited their vehicle and left the race.", ReturnPlayerName( playerid ), playerid ); SendClientMessageToRace( iRace, COLOR_GREY, "[RACE]"COL_WHITE" %s(%d) has exited their vehicle and left the race.", ReturnPlayerName( playerid ), playerid );
RemovePlayerFromRace( playerid ); RemovePlayerFromRace( playerid );
} }
}
return 1; return 1;
} }
@ -426,7 +429,7 @@ CMD:race( playerid, params[ ] )
g_raceData[ id ] [ E_POOL ] = prizePool; g_raceData[ id ] [ E_POOL ] = prizePool;
g_raceData[ id ] [ E_RACE_FINISH_SET ] = 0; g_raceData[ id ] [ E_RACE_FINISH_SET ] = 0;
g_raceData[ id ] [ E_STARTED ] = false; g_raceData[ id ] [ E_STARTED ] = false;
g_raceData[ id ] [ E_OUTRUN_DISTANCE ] = 50.0; g_raceData[ id ] [ E_OUTRUN_DISTANCE ] = 250.0;
g_raceData[ id ] [ E_FINISHED_COUNT ] = 0; g_raceData[ id ] [ E_FINISHED_COUNT ] = 0;
g_raceData[ id ] [ E_POSITION_PRIZE ] [ 0 ] = 1.0, g_raceData[ id ] [ E_POSITION_PRIZE ] [ 1 ] = 0.0, g_raceData[ id ] [ E_POSITION_PRIZE ] [ 2 ] = 0.0; g_raceData[ id ] [ E_POSITION_PRIZE ] [ 0 ] = 1.0, g_raceData[ id ] [ E_POSITION_PRIZE ] [ 1 ] = 0.0, g_raceData[ id ] [ E_POSITION_PRIZE ] [ 2 ] = 0.0;
g_raceData[ id ] [ E_FINISH_POS ] [ 0 ] = 1.0, g_raceData[ id ] [ E_FINISH_POS ] [ 1 ] = 0.0, g_raceData[ id ] [ E_FINISH_POS ] [ 2 ] = 0.0; g_raceData[ id ] [ E_FINISH_POS ] [ 0 ] = 1.0, g_raceData[ id ] [ E_FINISH_POS ] [ 1 ] = 0.0, g_raceData[ id ] [ E_FINISH_POS ] [ 2 ] = 0.0;