Advertisement
Guest User

Ranchermin

a guest
Dec 21st, 2011
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.17 KB | None | 0 0
  1. // Tank minigun script by Mean.
  2. // I don't care about the credits much, but don't
  3. // be self-ish.
  4.  
  5.  
  6. #include < a_samp >
  7. #include < streamer >
  8.  
  9. #define MAX_MINIGUNS 100
  10. #undef MAX_PLAYERS
  11. #define MAX_PLAYERS 100
  12. new
  13.         mgun[ MAX_MINIGUNS ]
  14.         ,minigunnum = 0
  15.         ,vehhasminigun[ MAX_VEHICLES ]
  16.         ,laser[ MAX_PLAYERS ]
  17. ;
  18.  
  19. #define PUB:%1(%2) forward %1(%2); public %1(%2)
  20.  
  21. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  22. {
  23.         new Float:a;
  24.         GetPlayerPos(playerid, x, y, a);
  25.         GetPlayerFacingAngle(playerid, a);
  26.         if (GetPlayerVehicleID(playerid))
  27.         {
  28.             GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  29.         }
  30.         x += (distance * floatsin(-a, degrees));
  31.         y += (distance * floatcos(-a, degrees));
  32. }
  33.  
  34. public OnFilterScriptInit( ) {
  35.         for( new i = 0; i < MAX_VEHICLES; ++i )
  36.             vehhasminigun[ i ] = 0;
  37.         SetTimer( "check", 1000, 1 );
  38.         SetTimer( "loop", 500, 1 );
  39.         print( "Miniguns on tanks by Mean loaded." );
  40.         return 1;
  41. }
  42.  
  43. PUB:check( )
  44. {
  45.         for( new i = 0; i < MAX_VEHICLES; ++i )
  46.         {
  47.                 new model = GetVehicleModel( i );
  48.                 if( model == 432 )
  49.                 {
  50.                     if( vehhasminigun[ i ] == 0 )
  51.                         {
  52.                                 vehhasminigun[ i ] = 1;
  53.                                 mgun[ minigunnum ] = CreateObject( 2985, 0, 0, 0, 0, 0, 0 );
  54.                                 AttachObjectToVehicle( mgun[ minigunnum ], i, 0.594999, 2.230003, -0.194999, 0.000000, 0.000000, 91.454948 );
  55.                                 minigunnum ++;
  56.                         }
  57.                 }
  58.         }
  59.         return 1;
  60. }
  61.  
  62. PUB:loop( ) {
  63.         for( new i = 0; i < MAX_PLAYERS; ++i )
  64.         {
  65.             if( IsPlayerConnected( i ) )
  66.             {
  67.                         new vehicleid = GetPlayerVehicleID( i );
  68.                         new model = GetVehicleModel( vehicleid );
  69.                         if( model == 490 ) {
  70.                         new keys,ud,lr;
  71.                         GetPlayerKeys( i, keys, ud, lr );
  72.                         if( keys & 128 )
  73.                         {
  74.                             SetPlayerAttachedObject( i, 0, 18695, 1, 0.379999, 1.799999, -2.700000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
  75.                             laser[ i ] = CreateObject( 19084, 0.75, 3.84, 0.86, 0.00, 0.00, 92.61 );
  76.                             AttachObjectToVehicle( laser[ i ], vehicleid, 0.73, 4.18, 0.86, 0.00, 0.00, 88.03 );
  77.                             PlayerPlaySound( i, 1135, 0.0, 0.0, 0.0 );
  78.                             SetTimerEx( "destroy", 250, 0, "i", i );
  79.                             new Float:x,Float:y,Float:z,Float:x2,Float:y2;
  80.                             GetPlayerPos( i, x2, y2, z );
  81.                             #pragma unused x2
  82.                             #pragma unused y2
  83.                             GetXYInFrontOfPlayer( i, x, y, 5.0 );
  84.                                         for( new u = 0; u < MAX_PLAYERS; ++u )
  85.                                         {
  86.                                                 if( IsPlayerInRangeOfPoint( u, 6.0, x, y, z ) && u != i )
  87.                                                 {
  88.                                                     new Float:hp,Float:hp2;
  89.                                                     GetPlayerHealth( u, hp );
  90.                                                     SetPlayerHealth( u, hp - 5 );
  91.                                                     GetPlayerHealth( u, hp2 );
  92.                                                     PlayerPlaySound( u, 1135, 0.0, 0.0, 0.0 );
  93.  
  94.                                                     if( hp2 < 1 )
  95.                                                         CallLocalFunction( "OnPlayerDeath", "ddd", u, i, 38 );
  96.                                                 }
  97.                                         }
  98.                                 }
  99.                         }
  100.                 }
  101.         }
  102.         return 1;
  103. }
  104.  
  105. PUB:destroy( i ) {
  106.         RemovePlayerAttachedObject( i, 0 );
  107.         DestroyObject( laser[ i ] );
  108.         return 1;
  109. }
  110.  
  111. public OnPlayerDeath( playerid, killerid, reason ) {
  112.         // Paste your OnPlayerDeath here!
  113.         return 1;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement