vehicleFix.inc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #if !defined Vehicle@YSII_Ag
  2. // Create the iterator.
  3. new Iterator:Vehicle<MAX_VEHICLES>;
  4. // Remove the warning messages.
  5. //
  6. // foreach generate names with tags.
  7. #pragma unused Vehicle@YSII_Ag, Vehicle@YSII_Cg
  8. #endif
  9. #include <a_http>
  10. #if defined USE_REGEX
  11. #tryinclude <regex> // [Plugin] Regular expression by Fro1sha: http://forum.sa-mp.com/showthread.php?t=247893
  12. #if !defined _regex_included && !define regex_match_exid
  13. #undef USE_REGEX
  14. #error "Can't find regex plugin"
  15. #endif
  16. #endif
  17. stock VIH_AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
  18. {
  19. new vehicleid = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
  20. Iter_Add(Vehicle, vehicleid);
  21. return vehicleid;
  22. }
  23. #if defined _ALS_AddStaticVehicle
  24. #undef AddStaticVehicle
  25. #else
  26. #define _ALS_AddStaticVehicle
  27. #endif
  28. #define AddStaticVehicle VIH_AddStaticVehicle
  29. stock VIH_AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren = 0)
  30. {
  31. new vehicleid = AddStaticVehicleEx(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2, respawn_delay, addsiren);
  32. Iter_Add(Vehicle, vehicleid);
  33. return vehicleid;
  34. }
  35. #if defined _ALS_AddStaticVehicleEx
  36. #undef AddStaticVehicleEx
  37. #else
  38. #define _ALS_AddStaticVehicleEx
  39. #endif
  40. #define AddStaticVehicleEx VIH_AddStaticVehicleEx
  41. stock VIH_CreateVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, siren = 0)
  42. {
  43. new vehicleid = CreateVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2, respawn_delay, siren);
  44. Iter_Add(Vehicle, vehicleid);
  45. return vehicleid;
  46. }
  47. #if defined _ALS_CreateVehicle
  48. #undef CreateVehicle
  49. #else
  50. #define _ALS_CreateVehicle
  51. #endif
  52. #define CreateVehicle VIH_CreateVehicle
  53. stock VIH_DestroyVehicle(vehicleid)
  54. {
  55. Iter_Remove(Vehicle, vehicleid);
  56. return DestroyVehicle(vehicleid);
  57. }
  58. #if defined _ALS_DestroyVehicle
  59. #undef DestroyVehicle
  60. #else
  61. #define _ALS_DestroyVehicle
  62. #endif
  63. #define DestroyVehicle VIH_DestroyVehicle
  64. #if defined USE_REGEX
  65. stock IsValidYoutubeUrl(const url[])
  66. {
  67. static RegEx:rHex;
  68. if(!rHex)
  69. {
  70. rHex = regex_build(\"((http(s)?:\/\/)?)(www\.)?((youtube\.com\/)|(youtu.be\/))[\S]+");
  71. }
  72. return regex_match_exid(url, rHex);
  73. }
  74. stock PlayAudioStream_Ex(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
  75. {
  76. if(IsValidYoutubeUrl(url))
  77. {
  78. PlayYoutubeStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
  79. }
  80. else
  81. {
  82. PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
  83. }
  84. }
  85. #if defined _ALS_PlayAudioStreamForPlayer
  86. #undef PlayAudioStreamForPlayer
  87. #else
  88. #define _ALS_PlayAudioStreamForPlayer
  89. #endif
  90. #define PlayAudioStreamForPlayer PlayAudioStream_Ex