SHARE
TWEET

Simple Vehicle FS

a guest May 8th, 2010 689 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.         *   Simple Vehicle Script by Lorenc
  3.         *   Created by Lorenc.
  4.         *
  5. */
  6. #include <a_samp>
  7. #define VEHDIALOG 2132
  8. new currentveh;
  9. new AllTheCars[125] =
  10. {
  11.     480,533,439,555,499,422,482,498,609,524,578,455,403,414,582,443,514,413,515,440,
  12.         543,605,459,531,408,552,478,456,554,536,575,534,567,535,566,576,412,
  13.         568,424,573,579,400,500,444,556,557,470,489,505,495,445,504,401,
  14.         518,527,542,507,562,585,419,526,604,466,492,474,546,517,410,551,516,467,600,426,436,547,405,580,
  15.         560,550,549,540,491,529,421,602,429,496,402,541,415,589,587,585,594,502,503,411,
  16.         559,603,475,506,451,558,477,418,404,479,458,561,409,525,583,539,442,423,
  17.         572,571,598,545,434,508,483,457,485,433
  18. };
  19.  
  20. public OnFilterScriptInit()
  21. {
  22.         print("\n--------------------------------------");
  23.         print(" Blank Filterscript by your name here");
  24.         print("--------------------------------------\n");
  25.         return 1;
  26. }
  27.  
  28. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  29. {
  30.         if (newkeys & KEY_SUBMISSION)
  31.         {
  32.             if(IsPlayerInCar(playerid))
  33.             {
  34.                         ShowPlayerDialog(playerid, VEHDIALOG, DIALOG_STYLE_LIST, "Vehicle", "Repair my car\nFlip my car\nNOS\nRims Added\nExplode my car\nCar Colour", "Select", "Cancel");
  35.                 }
  36.         }
  37.         return 1;
  38. }
  39.  
  40. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  41. {
  42.     if(dialogid == VEHDIALOG)
  43.         {
  44.                 if(response)
  45.                 {
  46.                         if(listitem == 0) // repair vehicle
  47.                         {
  48.                             currentveh = GetPlayerVehicleID(playerid);
  49.                             SetVehicleHealth(currentveh,1000.0);
  50.                                 GameTextForPlayer(playerid,"~r~Vehicle Repaired.",2500,5);
  51.                                 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  52.                         }
  53.                         if(listitem == 1) // flip vehicle
  54.                         {
  55.                                 currentveh = GetPlayerVehicleID(playerid);
  56.                                 new Float:angle;
  57.                         GetVehicleZAngle(currentveh, angle);
  58.                         SetVehicleZAngle(currentveh, angle);
  59.                         GameTextForPlayer(playerid,"~r~Vehicle Fliped.",2500,5);
  60.                         PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  61.                         }
  62.                         if(listitem == 2) //nos
  63.                         {
  64.                 currentveh = GetPlayerVehicleID(playerid);
  65.                                 AddVehicleComponent(currentveh, 1010);
  66.                                 GameTextForPlayer(playerid,"~r~NOS added",2500,5);
  67.                                 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  68.                         }
  69.                         if(listitem == 3) //rims
  70.                         {
  71.                             currentveh = GetPlayerVehicleID(playerid);
  72.                                 AddVehicleComponent(currentveh, 1074);
  73.                                 GameTextForPlayer(playerid,"~r~Rims added",2500,5);
  74.                                 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  75.                         }
  76.                         if(listitem == 4) //Explode mi vehicle
  77.                         {
  78.                 currentveh = GetPlayerVehicleID(playerid);
  79.                                 new Float:x, Float:y, Float:z;
  80.                                 new veh = GetPlayerVehicleID(playerid);
  81.                                 GetVehiclePos(veh, x, y, z);
  82.                                 CreateExplosion(x+random(5), y+random(5), z+random(5), 10, 30.0);
  83.                                 GameTextForPlayer(playerid,"~r~Car Exploded",2500,5);
  84.                                 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  85.                         }
  86.                         if(listitem == 5) //Car Colour
  87.                         {
  88.                             new AllTheColours[33] =
  89.                                 {
  90.                                         1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 24, 25, 26,
  91.                                         151, 144, 126, 175, 37, 104, 65, 165, 146, 184, 255, 118, 114, 27
  92.                                 };
  93.                                 currentveh = GetPlayerVehicleID(playerid);
  94.                                 for(new i = 0; i < 33; i++)
  95.                 {
  96.                 ChangeVehicleColor(currentveh, AllTheColours[i], 0);
  97.                                 }
  98.                                 GameTextForPlayer(playerid,"~r~Colour added",2500,5);
  99.                                 PlayerPlaySound(playerid, 1133, 0.0, 0.0, 10.0);
  100.                         }
  101.                 }
  102.         }
  103.         return 1;
  104. }
  105.  
  106. //********************************* Functions **************************************
  107.  
  108. stock IsPlayerInCar(playerid)
  109. {
  110.     new vehicleid = GetPlayerVehicleID(playerid);
  111.     if(IsPlayerInVehicle(playerid,vehicleid))
  112.     {
  113.                 for(new i = 0; i < 125; i++)
  114.                 {
  115.                     if(GetVehicleModel(vehicleid) == AllTheCars[i])
  116.                     {
  117.                         return true;
  118.                     }
  119.                 }
  120.     }
  121.     return false;
  122. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top