Advertisement
Guest User

RoapVeh v1.5

a guest
Sep 14th, 2011
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.55 KB | None | 0 0
  1. #if defined ROAPVEH_V1_5_
  2. ================================================================================
  3.                            RoapVeh v1.5 by Roach
  4. ================================================================================
  5.    - Credits to Zeex for ZCMD and for VEH:(...) ideea.
  6.    - Credits to stuntman from some ideeas and councils.
  7.    - Credits to Y_Less for y_hook and all the YSI Library.
  8.    - Credits to Roach for this Include :)).
  9.    
  10. ================================================================================
  11.                            Log RoapVeh v1.5
  12. ================================================================================
  13.   - [Removed]: pVeh Variable.
  14.   - [Added]: pVariable.
  15.   - [Added]: Y_HOOK ! ! !
  16.   - [Added]: VEH: Define. ( Thanks ZeeX )
  17.   - [Added]: Hook Function...
  18.   - [ADDED]: Destroy This F**ing Vehicle when Player Disconnect.
  19. ================================================================================
  20. #endif
  21.  
  22. #include <YSI/y_hooks>
  23. // Some Shorcuts
  24. #define Public:%0(%1)\
  25.         forward %0(%1);\
  26.             public %0(%1)
  27.            
  28. #define VEH:%0(%1)\
  29.             VEH(%0, %1)
  30.  
  31. Public:VEH( vehID, playerid )
  32. {
  33.     // Create Floats
  34.     new
  35.         Float: pvPos[ 4 ]
  36.     ;
  37.    
  38.     // Checks...
  39.     if( GetPlayerVehicleID( playerid ) == GetPVarInt( playerid, "pVeh" ) ) return SendClientMessage( playerid, -1, "You are already sitting in your Personal Car!" );
  40.     if( IsPlayerInAnyVehicle( playerid ) ) RemovePlayerFromVehicle( playerid );
  41.    
  42.     // Destroy Old Vehicle
  43.     DestroyVehicle( GetPVarInt( playerid, "pVeh" ) );
  44.    
  45.     // Get Position
  46.     GetPlayerPos( playerid, pvPos[ 0 ], pvPos[ 1 ], pvPos[ 2 ] );
  47.     GetPlayerFacingAngle( playerid, pvPos[ 3 ] );
  48.    
  49.     // Create Vehicle
  50.     SetPVarInt( playerid, "pVeh", CreateVehicle( vehID, pvPos[ 0 ], pvPos[ 1 ], pvPos[ 2 ] + 3, pvPos[ 3 ], 75, 3, 5000000 ) );
  51.     //pVeh[ playerid ] = CreateVehicle( vehID, pvPos[ 0 ], pvPos[ 1 ], pvPos[ 2 ] + 3, pvPos[ 3 ], 75, 3, 5000000 );
  52.    
  53.     // Set VW and INT and Put Player in Vehicle
  54.     LinkVehicleToInterior( GetPVarInt( playerid, "pVeh" ), GetPlayerInterior( playerid ) );
  55.     SetVehicleVirtualWorld( GetPVarInt( playerid, "pVeh" ), GetPlayerVirtualWorld( playerid ) );
  56.     PutPlayerInVehicle( playerid, GetPVarInt( playerid, "pVeh" ), 0 );
  57.    
  58.     // Set Params...
  59.     for( new i = 0; i < MAX_PLAYERS; i++ )
  60.     {
  61.         if( IsPlayerConnected( i ) && i != playerid )
  62.         {
  63.             SetVehicleParamsForPlayer( GetPVarInt( playerid, "pVeh" ), i, 0, 1 );
  64.         }
  65.     }
  66.     return ( 1 );
  67. }
  68.  
  69. Hook:pVeh_OnPlayerDisconnect( playerid, reason )
  70. {
  71.     DestroyVehicle( GetPVarInt( playerid, "pVeh" ) );
  72.     return ( 1 );
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement