Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new
- UltimulVehicul [ MAX_PLAYERS ],
- Arma [ MAX_PLAYERS ]
- ;
- stock GetDriverID ( veh )
- {
- foreach ( Player, i )
- {
- if( GetPlayerState ( i ) == PLAYER_STATE_DRIVER && GetPlayerVehicleID ( i ) == veh )
- return i;
- }
- return INVALID_PLAYER_ID;
- }
- public OnPlayerStateChange ( playerid, newstate, oldstate )
- {
- if ( newstate == PLAYER_STATE_DRIVER )
- {
- UltimulVehicul [ playerid ] = GetPlayerVehicleID ( playerid );
- foreach ( Player, i )
- {
- if ( GetPlayerVehicleID ( i ) == UltimulVehicul [ playerid ] )
- {
- if ( i == playerid ) continue;
- SetPlayerArmedWeapon ( i, Arma [ i ] );
- }
- }
- }
- if ( newstate == PLAYER_STATE_PASSENGER )
- {
- if ( GetDriverID ( GetPlayerVehicleID ( playerid ) ) == INVALID_PLAYER_ID )
- {
- foreach ( Player, i )
- {
- new
- arma = GetPlayerWeapon ( i )
- ;
- if ( arma != 0 )
- {
- Arma [ i ] = arma;
- SetPlayerArmedWeapon ( i, 0 );
- }
- }
- }
- }
- if ( oldstate == PLAYER_STATE_DRIVER )
- {
- foreach ( Player, i )
- {
- if ( ( GetPlayerVehicleID ( i ) == UltimulVehicul [ playerid ] ) && UltimulVehicul [ playerid ] != INVALID_VEHICLE_ID )
- {
- new
- arma = GetPlayerWeapon ( i )
- ;
- if ( arma != 0 )
- {
- Arma [ i ] = arma;
- SetPlayerArmedWeapon ( i, 0 );
- }
- }
- }
- UltimulVehicul [ playerid ] = INVALID_VEHICLE_ID;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement