Guest User

Leans Helicopter Thermal Mode

a guest
Feb 11th, 2015
2,325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.95 KB | None | 0 0
  1. /*
  2.  
  3. ***'**'*'*'****
  4. CREDITS: Lean
  5. Date of Creation: 2015-02-11
  6. ***'**'*'*'****
  7.  
  8. Helicopter Thermal Mode By Lean
  9.  
  10.  
  11.  
  12. */
  13.  
  14. //INCLUDES
  15. #include <a_samp>
  16. #include <zcmd>
  17. #include <streamer>
  18.  
  19.  
  20. // DEFINE FOR LEANCMD
  21. #define LEANCMD:(%1) CMD:%1(playerid, params[])
  22.  
  23.  
  24.  
  25. #define SCM SendClientMessage
  26.  
  27. //COLORS
  28. #define COL_ORANGE "{FF9900}"
  29. #define COLOR_LIGHTRED 0xFF6347AA
  30. #define COL_WHITE "{FFFFFF}"
  31.  
  32. //NEWS
  33. new objectids[MAX_VEHICLES];
  34. new Text:crosshair[MAX_PLAYERS];
  35. new playerveh[MAX_PLAYERS];
  36.  
  37. //FORWARDS
  38. forward THERMALON( playerid, veh );
  39. forward THERMALOFF(playerid);
  40.  
  41. //CALLBACKS
  42. public OnFilterScriptInit()
  43. {
  44.     print("\n--------------------------------------");
  45.     print(" Leans Helicopter Thermal Mode");
  46.     print("--------------------------------------\n");
  47.     return 1;
  48. }
  49.  
  50. public OnFilterScriptExit()
  51. {
  52.     return 1;
  53. }
  54.  
  55.  
  56.  
  57. public OnPlayerStateChange(playerid, newstate, oldstate)
  58. {
  59.     if(oldstate == PLAYER_STATE_PASSENGER && newstate == PLAYER_STATE_ONFOOT) // checking if player was in a vehicle
  60.     {
  61.         if(GetPVarInt( playerid, "ThermalActive" ) == 1) // Checking if player have thermal active
  62.         {
  63.             THERMALOFF( playerid ); // If Player exits vehicle we set his thermal mode off
  64.         }
  65.     }
  66.     return 1;
  67. }
  68.  
  69.  
  70. public THERMALON( playerid, veh )
  71. {
  72.         TextDrawDestroy( crosshair[playerid] ); //Destroying the crosshair
  73.         crosshair[playerid] = TextDrawCreate( 306.0, 218.0, "+" ); // Creating the crosshair
  74.         TextDrawLetterSize( crosshair[playerid], 1.4 ,1.4 ); //Setting the size of the crosshair
  75.         TextDrawShowForPlayer( playerid, crosshair[playerid] ); //Showing the crosshair for the player
  76.         objectids[veh] = CreateObject( 3785,0,0,0,0,0,0,80 ); // creating a light object as it will act like a camera
  77.         AttachObjectToVehicle( objectids[veh], veh, 0.000000, 2.599999, -0.800000, 0.000000, 0.000000, 0.000000 ); // attaching the object to the helicoper
  78.         AttachCameraToObject( playerid, objectids[veh] ); // now we attach our camera to the object
  79.         SetPVarInt( playerid, "ThermalActive", 1 ); // setting thermalactive true
  80.         SCM( playerid,COLOR_LIGHTRED,"NOTICE: "COL_WHITE"You are now in Thermal mode. To leave thermal mode type /helithermal" );
  81.         SCM( playerid,COLOR_LIGHTRED,"WARNING: "COL_WHITE"You are still able to exit vehicle." );
  82.         playerveh[playerid] = veh; // Storing the vehicleID in a variable
  83.         return 1;
  84. }
  85.  
  86.  
  87.  
  88. public THERMALOFF(playerid)
  89. {
  90.         TextDrawDestroy( crosshair[playerid] ); // Destroying the crosshair
  91.         new vehid = playerveh[playerid];
  92.         SCM( playerid,COLOR_LIGHTRED,"NOTICE: "COL_WHITE"You have left thermal mode." );
  93.         DeletePVar( playerid,"ThermalActive" ); // Deleting thermalactive from player
  94.         SetCameraBehindPlayer( playerid ); // Setting the camera back to the player
  95.         DestroyObject(objectids[vehid]); // Destroying the light from the helicopter
  96.         return 1;
  97. }
  98.  
  99. //COMMANDS
  100.  
  101.  
  102. LEANCMD:(helithermal)
  103. {
  104.     new vehi = GetPlayerVehicleID( playerid );
  105.     if( IsPlayerInAnyVehicle(playerid) ) // Checking if player is in any vehicle at all
  106.     {
  107.         if( GetVehicleModel( vehi ) == 497 ) // If player was in vehicle ,we now check if he is in police helicopter
  108.         {
  109.             if( GetPlayerVehicleSeat(playerid) == 1 ) // Checking if he is in passenger seat
  110.             {
  111.        
  112.                 if( GetPVarInt( playerid, "ThermalActive" ) == 0 ) // If player dosent have thermalactive
  113.                 {
  114.                     THERMALON( playerid, vehi ); // We now set the player in thermal mode.
  115.                 }
  116.                 else // IF he wasent in thermalmode
  117.                 {
  118.                     THERMALOFF( playerid ); // We now set the player back to normal
  119.                 }
  120.             }
  121.             else return SCM(playerid,COLOR_LIGHTRED,"ERROR: "COL_WHITE"This is for co-pilots only. ((FRONT PASSANGER))" );
  122.         }
  123.         else return SCM(playerid, COLOR_LIGHTRED,"ERROR: "COL_WHITE"This vehicle is not supported with a thermal camera.");
  124.     }
  125.     else return SCM(playerid,COLOR_LIGHTRED,"ERROR: "COL_WHITE"You are not in any vehicle.");
  126. }
  127.  
  128.  
  129.  
  130.  
  131. //END OF LEANS HELICOPTER THERMAL MODE
Advertisement
Add Comment
Please, Sign In to add comment