Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // =========================================== S E R V E R E V E N T S ==============================================
- function onScriptLoad()
- {
- dofile( "scripts/S_TuningSystem.nut" );
- tuneCreateMenu( );
- tuneCreateSecondMenu( );
- }
- // =========================================== P L A Y E R E V E N T S ==============================================
- function onPlayerJoin( player )
- {
- tuneJoin( player );
- }
- function onVehicleExplode( vehicle )
- {
- // Tuning System
- if( tuneHydraulicsEnabled[ vehicle.ID ] == 1 ) tuneHydraulicsEnabled[ vehicle.ID ] = 0;
- }
- function onPlayerCommand( player, cmd, text )
- {
- if( cmd == "tune" )
- {
- if( !player.Spawned ) MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorError + " [ Error ] " + tuneColorText + "You must be spawned to use this command !", player );
- else if( !player.Vehicle ) MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorError + " [ Error ] " + tuneColorText + "You can't tune yourself, take a vehicle !", player );
- else if( player.VehicleSlot != 0 ) MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorError + " [ Error ] " + tuneColorText + "Only the driver can tune the car !", player );
- else if( menuOnScreen[ player.ID ] > -1 ) MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorError + " [ Error ] " + tuneColorText + "Close the shown menu first, then try again !", player);
- else
- {
- local vehicle = player.Vehicle,
- type = VehType( player.Vehicle.Model );
- tuneSavedPos[ player.ID ] = vehicle.Pos;
- tuneSavedAngle[ player.ID ] = vehicle.EulerAngle;
- player.World = TUNE_WORLD + player.ID;
- vehicle.World = TUNE_WORLD + player.ID;
- vehicle.Pos = TUNE_CAMERA_LOOK;
- vehicle.EulerAngle = Vector( -0.0205094, -0.0224766, -1.41861 );
- player.Vehicle = vehicle;
- switch( type )
- {
- case "Car":
- menu[ tuneMenuID ].ShowMenu( player );
- break;
- default:
- menu[ tuneSecondMenuID ].ShowMenu( player );
- break;
- }
- MessagePlayer( tuneColorPrefix + "[ Tuning System by Seby ]" + tuneColorEnabled + " Welcome ! Good luck in personalizating your car !", player );
- MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorEnabled + " Use arrows, spacebar and backspace to interact with the menu !", player)
- }
- }
- else if(cmd == "hydraulicskeys")
- {
- if( tuneHydraulicsVariant[ player.ID ] == 0 )
- {
- MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorText + " Hydraulics' Keys were changed to " + tuneColorEnabled + "U (up), J (down), H (left), K (right)" + tuneColorDisabled + " !", player );
- tuneHydraulicsVariant[ player.ID ] = 1;
- return;
- }
- else
- {
- MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorText + " Hydraulics' Keys were changed to " + tuneColorEnabled + "NUMPAD 8 (up), 2 (down), 4 (left), 6 (right)" + tuneColorDisabled + " !", player );
- tuneHydraulicsVariant[ player.ID ] = 0;
- return;
- }
- }
- }
- // =========================================== B I N D E V E N T S ==============================================
- function onKeyDown( player, key )
- {
- tuneKeyDown( player, key );
- }
- // ====================================== C U S T O M M E N U E V E N T S =========================================
- function onPlayerEnterMenu( player, menuID )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- player.SetCameraPos( TUNE_CAMERA_TOP, TUNE_CAMERA_LOOK );
- break;
- default: break;
- }
- }
- function onPlayerExitMenu( player, menuID )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- ::MessagePlayer( tuneColorPrefix + "[ Tuning ]" + tuneColorEnabled + " Enjoy your ride ! See you soon ! 8)", player);
- tuneExitMenu( player );
- break;
- default: break;
- }
- }
- function onPlayerEnterSubmenu( player, menuID, submenuID )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- tuneEnterSubmenu( player, menuID, submenuID );
- break;
- default: break;
- }
- }
- function onPlayerExitSubmenu( player, menuID, submenuID )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- player.SetCameraPos( TUNE_CAMERA_TOP, TUNE_CAMERA_LOOK );
- break;
- default: break;
- }
- }
- function onPlayerSwitchOptionsInSubmenu( player, menuID, submenuID, oldOption, newOption )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- tuneSwitchOptionsInSubmenu( player, menuID, submenuID, oldOption, newOption );
- break;
- default: break;
- }
- }
- function onPlayerSelectInMenu( player, menuID, option )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- tuneSelectInMenu( player, menuID, option );
- break;
- default: break;
- }
- }
- function onPlayerSelectInSubmenu( player, menuID, submenuID, option )
- {
- switch( menuID )
- {
- // Tuning System
- case tuneMenuID: // first menu
- case tuneSecondMenuID: // second menu
- tuneSelectInSubmenu( player, menuID, submenuID, option );
- break;
- default: break;
- }
- }
- // ================================== E N D OF O F F I C I A L E V E N T S ======================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement