Advertisement
Guest User

RoavOwn v1.0

a guest
Oct 21st, 2011
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.72 KB | None | 0 0
  1. #if defined ROAVOWN_V1_0_
  2. ================================================================================
  3.                            RoavOwn v1.0 by Roach
  4. ================================================================================
  5.    - Credits to SA:MP Development Team for their Incredible Mode ( SA:MP ).
  6.    - Credits to Zeex for ZCMD and for vOWN:(...) ideea.
  7.    - Credits to Zh3r0 from some ideeas and councils.
  8.    - Credits to Y_Less for y_hook, y_timers and all the YSI Library.
  9.    - Credits to Slice for the 'global' define Ideea.
  10.    - Credits to Zonoya for the Personal Cars Ideea. ( RoapVeh )
  11.    
  12. ================================================================================
  13.                            Log RoavOwn v1.0
  14. ================================================================================
  15.   - [Added]: enum and Variable.
  16.   - [Added]: Y_HOOK and Y_TIMERS ! ! !
  17.   - [Added]: vOWN: Define. ( Thanks ZeeX )
  18.   - [Added]: Hook Function...
  19.   - [Added]: Count Variable.
  20.   - [Added]: Timer Function.
  21.   - [ENDED]: The vOwn Function and Added the FormMSG Define.
  22. ================================================================================
  23. #endif
  24.  
  25. #include <    a_samp    > // Credits to SA:MP Development Team
  26. #include < YSI\y_hooks  > // Credits to Y_Less
  27. #include < YSI\y_timers > // Credits to Y_Less
  28.  
  29. // Some Shorcuts and Changes...
  30. #define         Public:%0(%1)\
  31.                  forward %0(%1);\
  32.                     public %0(%1)
  33.            
  34. #define         vOWN:%0(%1,%2,%3,%4,%5)\
  35.                     vOWN(%0,%1,%2,%3,%4,%5)
  36.            
  37. #define         FormMSG(%0,%1,%2,%3)\
  38.                 do{\
  39.                     new _S_T_R_[ 500 ];\
  40.                     format(_S_T_R_, sizeof (_S_T_R_), (%2), %3);\
  41.                     SendClientMessage((%0),(%1), _S_T_R_);\
  42.                 }\
  43.                 while (False)
  44.  
  45. #define global  stock
  46.        
  47. // Messages...
  48. #define ERROR_MSG "This isn't your car, it's {2299AA}%s{FFFFFF}'s car."
  49. #define ENTER_MSG "Welcome back, {2299AA}%s{FFFFFF} !"
  50.  
  51.            
  52. new
  53.     v_Count = 0
  54. ;
  55. stock
  56.     bool:False = false
  57. ;
  58.  
  59. enum vOWN_enum
  60. {
  61.     Model,          Float: sX,
  62.     Float: sY,      Float: sZ,
  63.     Float: s_zA,    Col_1,
  64.     Col_2,          bool:v_Spawned,
  65.     v_Owner[ MAX_PLAYER_NAME ],
  66.     NumID
  67. };
  68. new v_DATE[ MAX_VEHICLES ][ vOWN_enum ];
  69.  
  70.  
  71. Public:vOWN( ModelID, uName[ ], Float: pX, Float: pY, Float: pZ, Float: zAng )
  72. {
  73.     v_Count ++;
  74.     format( v_DATE[ v_Count ][ v_Owner ], MAX_PLAYER_NAME, "%s", uName );
  75.     v_DATE[ v_Count ][ Model     ] = ModelID;
  76.     v_DATE[ v_Count ][ sX        ] = pX;
  77.     v_DATE[ v_Count ][ sY        ] = pY;
  78.     v_DATE[ v_Count ][ sZ        ] = pZ;
  79.     v_DATE[ v_Count ][ s_zA      ] = zAng;
  80.     v_DATE[ v_Count ][ v_Spawned ] = false;
  81.     return ( 1 );
  82. }
  83.  
  84. timer LoadvOwnVehicles[1000]( )
  85. {
  86.     if( v_Count > 0 )
  87.     {
  88.         for( new v = 1; v <= v_Count; v ++ )
  89.         {
  90.             if( !v_DATE[ v ][ v_Spawned ] )
  91.             {
  92.                 v_DATE[ v ][ NumID     ] = CreateVehicle( v_DATE[ v ][ Model ], v_DATE[ v ][ sX ], v_DATE[ v ][ sY ], v_DATE[ v ][ sZ ], v_DATE[ v ][ s_zA  ], random( 124 ), random( 124 ), -1 );
  93.                 v_DATE[ v ][ v_Spawned ] = true;
  94.                 printf( "%s's Vehicle Loaded Succesfully !", v_DATE[ v ][ v_Owner ] );
  95.             }
  96.         }
  97.     }
  98.     return ( 1 );
  99. }
  100.  
  101. Hook:OnPlayerStateChange( playerid, newstate, oldstate )
  102. {
  103.     new vehicleid = GetPlayerVehicleID( playerid );
  104.     if( newstate == PLAYER_STATE_DRIVER )
  105.     {
  106.         for( new v = 1; v <= v_Count; v ++ )
  107.         {
  108.             if( vehicleid == v_DATE[ v ][ NumID ] )
  109.             {
  110.                 if( strcmp( v_DATE[ v ][ v_Owner ], pName( playerid ) ) )
  111.                 {
  112.                     FormMSG( playerid, 0xFFFFFFFF, ERROR_MSG, v_DATE[ v ][ v_Owner ] );
  113.                     RemovePlayerFromVehicle( playerid );
  114.                     return ( 0 );
  115.                 }
  116.                 else FormMSG( playerid, 0xFFFFFFFF, ENTER_MSG, v_DATE[ v ][ v_Owner ] );
  117.             }
  118.         }
  119.         return ( 1 );
  120.     }
  121.     return ( 1 );
  122. }
  123.  
  124. global pName( playerid )
  125. {
  126.     new NAME[ MAX_PLAYER_NAME ];
  127.     GetPlayerName( playerid, NAME, sizeof NAME );
  128.     return ( NAME );
  129. }  
  130.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement