Guest User

c_vehicleinfo.inc

a guest
Mar 10th, 2010
748
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. /*
  2.  
  3. [ criticaL's Vehicle Info ]
  4.  
  5. - Version : 0.1
  6. - Author : criticaL aka Robban
  7. - Date : 30 April 2007
  8.  
  9. - Function list :
  10.  
  11. cAddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
  12. cAddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay)
  13. cGetVehicleModelID(vehicleid, &modelid)
  14. cGetVehicleSpawnPos(vehicleid, &Float:spawn_x, &Float:spawn_y, &Float:spawn_z, &Float:z_angle)
  15.  
  16. - Description :
  17.  
  18. With those simple functions you can get modelid out of a vehicleid which is not "possible" in the
  19. current version of SA-MP, and you can get spawn position of the vehicle aswell.
  20.  
  21. It is very simple to use, just put a "c" infront of the regular AddStaticVehicle and
  22. AddStaticVehicleEx.
  23.  
  24. NOTE: You will only be able to get information out of a vehicleid if you have used
  25. my functions, not the regular AddStaticVehicle and AddStaticVehicleEx!
  26.  
  27. And if you use the regular functions, you will fuck the vehicleid order up, so
  28. only use cAddStaticVehicle and cAddStaticvehicleEx.
  29.  
  30. ---------------------
  31.  
  32. Report any bugs to me, I didn't have much time to test it. ;)
  33.  
  34. - Remember : You haven't made this shit, so don't take any credits for it!
  35.  
  36. */
  37.  
  38. #if defined _criticalvehicle_included
  39. #endinput
  40. #endif
  41.  
  42. #define _criticalvehicle_included
  43. #include <a_samp>
  44.  
  45. /*
  46. native cAddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2);
  47. native cAddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay);
  48. native cGetVehicleModelID(vehicleid, &modelid);
  49. native cGetVehicleSpawnPos(vehicleid, &Float:spawn_x, &Float:spawn_y, &Float:spawn_z, &Float:z_angle);
  50. */
  51.  
  52. enum cVehicle_info
  53. {
  54. cVi_modelid,
  55. Float:cVi_spawn_x,
  56. Float:cVi_spawn_y,
  57. Float:cVi_spawn_z,
  58. Float:cVi_z_angle,
  59. }
  60.  
  61. static cVehicles[MAX_VEHICLES][cVehicle_info];
  62. static cVehicle_count;
  63.  
  64. stock cAddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
  65. {
  66. cVehicle_count ++;
  67.  
  68. cVehicles[cVehicle_count][cVi_modelid] = modelid;
  69. cVehicles[cVehicle_count][cVi_spawn_x] = spawn_x;
  70. cVehicles[cVehicle_count][cVi_spawn_y] = spawn_y;
  71. cVehicles[cVehicle_count][cVi_spawn_z] = spawn_z;
  72. cVehicles[cVehicle_count][cVi_z_angle] = z_angle;
  73.  
  74. AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2);
  75. }
  76.  
  77. stock cAddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay)
  78. {
  79. cVehicle_count ++;
  80.  
  81. cVehicles[cVehicle_count][cVi_modelid] = modelid;
  82. cVehicles[cVehicle_count][cVi_spawn_x] = spawn_x;
  83. cVehicles[cVehicle_count][cVi_spawn_y] = spawn_y;
  84. cVehicles[cVehicle_count][cVi_spawn_z] = spawn_z;
  85. cVehicles[cVehicle_count][cVi_z_angle] = z_angle;
  86.  
  87. AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay);
  88. }
  89.  
  90. stock cGetVehicleModelID(vehicleid, &modelid)
  91. {
  92. if (vehicleid < 1 || vehicleid > MAX_VEHICLES || vehicleid > cVehicle_count) return 0;
  93.  
  94. modelid = cVehicles[vehicleid][cVi_modelid];
  95.  
  96. return 1;
  97. }
  98.  
  99. stock cGetVehicleSpawnPos(vehicleid, &Float:spawn_x, &Float:spawn_y, &Float:spawn_z, &Float:z_angle)
  100. {
  101. if (vehicleid < 1 || vehicleid > MAX_VEHICLES || vehicleid > cVehicle_count) return 0;
  102.  
  103. spawn_x = cVehicles[vehicleid][cVi_spawn_x];
  104. spawn_y = cVehicles[vehicleid][cVi_spawn_y];
  105. spawn_z = cVehicles[vehicleid][cVi_spawn_z];
  106. z_angle = cVehicles[vehicleid][cVi_z_angle];
  107.  
  108. return 1;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment