04.03.2009, 01:58
Quote:
Originally Posted by Daren_Jacobson
start in OnPlayerExitVehicle
|
Anyway, first of all you will need a function to get the driver ID of a vehicle:
Код:
stock GetVehicleDriver ( iVehicleID ) { for ( new iDriverID; iDriverID < GetMaxPlayers ( ); iDriverID ++ ) { if ( GetPlayerState ( iDriverID ) == PLAYER_STATE_DRIVER ) { if ( GetPlayerVehicleID ( iDriverID ) == iVehicleID) return iDriverID; } } return INVALID_PLAYER_ID; }
E.g:
Код:
if ( IsPlayerInAnyVehicle ( iPassengerID ) { new iDriverID = GetVehicleDriver ( GetPlayerVehicleID ( iPassengerID )); if ( iDriverID != INVALID_PLAYER_ID ) { GivePlayerMoney ( iDriverID, 100); GivePlayerMoney ( iPassengerID, -100); } }