TiiP

[INCLUDE] Xenon Library - www.homehots.net

Jul 17th, 2015
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 11.78 KB | None | 0 0
  1. /*
  2.                                         ================================
  3.                                                   Xenon Library        
  4.                                         ================================
  5.  *  Versão: 1.0
  6.  *  Creditos:
  7.  *  Baseado no "Xenon Extremo" de romerorodriges
  8.  *  Editado por King_Vegeta
  9.  
  10.  * Natives:
  11.         native AttachXenonToVehicle(vehicleid, XenonColor);
  12.         native DestroyXenon(vehicleid);
  13.         native DestroyAllXenon();
  14. */
  15. #include <a_samp>
  16. #if defined _xLibrary_included
  17.         #endinput
  18. #endif
  19. #define _xLibrary_included
  20. #pragma library xLibrary
  21.  
  22. #define                 Azul                    1
  23. #define                 Verde                           2
  24. #define                 Vermelho                        3
  25. #define                 Branco                          4
  26. #define                 Violeta                     5
  27. #define             VerdeLimao                  6
  28. #define                 Rosa                    7
  29. #define                 Purpura                         8
  30. #define                 Amarelo                         9
  31. #define                 Aqua                            10
  32.  
  33. new
  34.         xenonazul[8][MAX_VEHICLES],
  35.         xenonverde[8][MAX_VEHICLES],
  36.         xenonbranco[8][MAX_VEHICLES],
  37.         xenonvermelho[8][MAX_VEHICLES]
  38. ;
  39.  
  40.  
  41. stock AttachXenonToVehicle( vehicleid, XenonColor )
  42. {
  43.         if(BadVehicleXenon(GetPlayerVehicleID(vehicleid)))
  44.         {
  45.                 print("ERROR: Veiculo nao supoarta Xenon.");
  46.         return 1;
  47.         }
  48.         DestroyXenon(vehicleid);
  49.     switch(XenonColor)
  50.     {
  51.                 case Azul:
  52.                 {
  53.                     DestroyXenon(vehicleid);
  54.                         AzulOne(vehicleid);
  55.                         AzulTwo(vehicleid);
  56.                 }
  57.                 case Verde:
  58.                 {
  59.                     DestroyXenon(vehicleid);
  60.                     VerdeOne(vehicleid);
  61.                     VerdeTwo(vehicleid);
  62.                 }
  63.                 case Vermelho:
  64.                 {
  65.                     DestroyXenon(vehicleid);
  66.                     VermelhoOne(vehicleid);
  67.                     VermelhoTwo(vehicleid);
  68.                 }
  69.                 case Branco:
  70.                 {
  71.                     DestroyXenon(vehicleid);
  72.                     BrancoOne(vehicleid);
  73.                     BrancoTwo(vehicleid);
  74.                 }
  75.                 case Violeta:
  76.                 {
  77.                     DestroyXenon(vehicleid);
  78.                     BrancoOne(vehicleid);
  79.                     BrancoTwo(vehicleid);
  80.                     AzulOne(vehicleid);
  81.                     AzulTwo(vehicleid);
  82.                 }
  83.                 case VerdeLimao:
  84.                 {
  85.                     DestroyXenon(vehicleid);
  86.                     BrancoOne(vehicleid);
  87.                     BrancoTwo(vehicleid);
  88.                     VerdeOne(vehicleid);
  89.                     VerdeTwo(vehicleid);
  90.                 }
  91.                 case Rosa:
  92.                 {
  93.                     DestroyXenon(vehicleid);
  94.                     BrancoOne(vehicleid);
  95.                     BrancoTwo(vehicleid);
  96.                     VermelhoOne(vehicleid);
  97.                     VermelhoTwo(vehicleid);
  98.                 }
  99.                 case Purpura:
  100.                 {
  101.                     DestroyXenon(vehicleid);
  102.                     VermelhoOne(vehicleid);
  103.                     VermelhoTwo(vehicleid);
  104.                     AzulOne(vehicleid);
  105.                     AzulTwo(vehicleid);
  106.                 }
  107.                 case Amarelo:
  108.                 {
  109.                         DestroyXenon(vehicleid);
  110.                     VermelhoOne(vehicleid);
  111.                     VermelhoTwo(vehicleid);
  112.                     VerdeOne(vehicleid);
  113.                     VerdeTwo(vehicleid);
  114.                 }
  115.                 case Aqua:
  116.                 {
  117.                     DestroyXenon(vehicleid);
  118.                     VerdeOne(vehicleid);
  119.                     VerdeTwo(vehicleid);
  120.                     AzulOne(vehicleid);
  121.                     AzulTwo(vehicleid);
  122.                 }
  123.                 default:
  124.                 {
  125.                         print("ERROR: Xenon Invalido.");
  126.                 }
  127.         }
  128.         return 1;
  129. }
  130.  
  131. stock BrancoOne(vehicleid)
  132. {
  133.         xenonbranco[0][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  134.         xenonbranco[1][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  135.         xenonbranco[2][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  136.         xenonbranco[3][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  137.         AttachObjectToVehicle(xenonbranco[0][vehicleid], vehicleid, -1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  138.         AttachObjectToVehicle(xenonbranco[1][vehicleid], vehicleid, -1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  139.         AttachObjectToVehicle(xenonbranco[2][vehicleid], vehicleid, -1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  140.         AttachObjectToVehicle(xenonbranco[3][vehicleid], vehicleid, -1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  141.         return 1;
  142. }
  143.  
  144. stock BrancoTwo(vehicleid)
  145. {
  146.         xenonbranco[4][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  147.         xenonbranco[5][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  148.         xenonbranco[6][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  149.         xenonbranco[7][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  150.         AttachObjectToVehicle(xenonbranco[4][vehicleid], vehicleid, 1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  151.         AttachObjectToVehicle(xenonbranco[5][vehicleid], vehicleid, 1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  152.         AttachObjectToVehicle(xenonbranco[6][vehicleid], vehicleid, 1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  153.         AttachObjectToVehicle(xenonbranco[7][vehicleid], vehicleid, 1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  154.         return 1;
  155. }
  156.  
  157. stock VermelhoOne(vehicleid)
  158. {
  159.         xenonvermelho[0][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  160.         xenonvermelho[1][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  161.         xenonvermelho[2][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  162.         xenonvermelho[3][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  163.         AttachObjectToVehicle(xenonvermelho[0][vehicleid], vehicleid, -1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  164.         AttachObjectToVehicle(xenonvermelho[1][vehicleid], vehicleid, -1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  165.         AttachObjectToVehicle(xenonvermelho[2][vehicleid], vehicleid, -1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  166.         AttachObjectToVehicle(xenonvermelho[3][vehicleid], vehicleid, -1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  167.         return 1;
  168. }
  169.  
  170. stock VermelhoTwo(vehicleid)
  171. {
  172.         xenonvermelho[4][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  173.         xenonvermelho[5][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  174.         xenonvermelho[6][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  175.         xenonvermelho[7][vehicleid] = CreateObject(19296,0,0,0,0,0,0);
  176.         AttachObjectToVehicle(xenonvermelho[4][vehicleid], vehicleid, 1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  177.         AttachObjectToVehicle(xenonvermelho[5][vehicleid], vehicleid, 1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  178.         AttachObjectToVehicle(xenonvermelho[6][vehicleid], vehicleid, 1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  179.         AttachObjectToVehicle(xenonvermelho[7][vehicleid], vehicleid, 1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  180.         return 1;
  181. }
  182.  
  183. stock VerdeOne(vehicleid)
  184. {
  185.         xenonverde[0][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  186.         xenonverde[1][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  187.         xenonverde[2][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  188.         xenonverde[3][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  189.         AttachObjectToVehicle(xenonverde[0][vehicleid], vehicleid, -1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  190.         AttachObjectToVehicle(xenonverde[1][vehicleid], vehicleid, -1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  191.         AttachObjectToVehicle(xenonverde[2][vehicleid], vehicleid, -1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  192.         AttachObjectToVehicle(xenonverde[3][vehicleid], vehicleid, -1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  193.         return 1;
  194. }
  195.  
  196. stock VerdeTwo(vehicleid)
  197. {
  198.         xenonverde[4][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  199.         xenonverde[5][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  200.         xenonverde[6][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  201.         xenonverde[7][vehicleid] = CreateObject(19297,0,0,0,0,0,0);
  202.         AttachObjectToVehicle(xenonverde[4][vehicleid], vehicleid, 1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  203.         AttachObjectToVehicle(xenonverde[5][vehicleid], vehicleid, 1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  204.         AttachObjectToVehicle(xenonverde[6][vehicleid], vehicleid, 1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  205.         AttachObjectToVehicle(xenonverde[7][vehicleid], vehicleid, 1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  206.         return 1;
  207. }
  208.  
  209. stock AzulOne(vehicleid)
  210. {
  211.         xenonazul[0][vehicleid] = CreateObject(19298,0,0,0,0,0,0);
  212.         xenonazul[1][vehicleid] = CreateObject(19298,0,0,0,0,0,0);
  213.         xenonazul[2][vehicleid] = CreateObject(19298,0,0,0,0,0,0);
  214.         xenonazul[3][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  215.         AttachObjectToVehicle(xenonazul[0][vehicleid], vehicleid, -1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  216.         AttachObjectToVehicle(xenonazul[1][vehicleid], vehicleid, -1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  217.         AttachObjectToVehicle(xenonazul[2][vehicleid], vehicleid, -1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  218.         AttachObjectToVehicle(xenonazul[3][vehicleid], vehicleid, -1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  219.         return 1;
  220. }
  221.  
  222. stock AzulTwo(vehicleid)
  223. {
  224.         xenonazul[4][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  225.         xenonazul[5][vehicleid] = CreateObject(19298,0,0,0,0,0,0);
  226.         xenonazul[6][vehicleid] = CreateObject(19298,0,0,0,0,0,0);
  227.         xenonazul[7][vehicleid] = CreateObject(19295,0,0,0,0,0,0);
  228.         AttachObjectToVehicle(xenonazul[4][vehicleid], vehicleid, 1.0, 3.0, -0.8, 0.0, 0.0, 0.0);
  229.         AttachObjectToVehicle(xenonazul[5][vehicleid], vehicleid, 1.0, 5.0, -0.8, 0.0, 0.0, 0.0);
  230.         AttachObjectToVehicle(xenonazul[6][vehicleid], vehicleid, 1.0, 6.0, -0.8, 0.0, 0.0, 0.0);
  231.         AttachObjectToVehicle(xenonazul[7][vehicleid], vehicleid, 1.0, 7.0, -0.8, 0.0, 0.0, 0.0);
  232.         return 1;
  233. }
  234.  
  235. stock DestroyXenon(vehicleid)
  236. {
  237.         for(new x; x < sizeof(xenonazul); x++)
  238.         {
  239.                 DestroyObject(xenonazul[x][vehicleid]);
  240.         }
  241.         for(new x; x < sizeof(xenonverde); x++)
  242.         {
  243.                 DestroyObject(xenonverde[x][vehicleid]);
  244.         }
  245.         for(new x; x < sizeof(xenonvermelho); x++)
  246.         {
  247.                 DestroyObject(xenonvermelho[x][vehicleid]);
  248.         }
  249.         for(new x; x < sizeof(xenonbranco); x++)
  250.         {
  251.                 DestroyObject(xenonbranco[x][vehicleid]);
  252.         }
  253.         return 1;
  254. }
  255.  
  256. stock BadVehicleXenon( vehicleid )
  257. {
  258.         new result;
  259.         new model = GetVehicleModel( vehicleid );
  260.     switch( model )
  261.     {
  262.         case 522,462,521,461,463,581,448,586,
  263.                 523,468,471,509,481,510,539,472,473,
  264.                 493,595,484,430,453,452,446,454,548,
  265.                 425,417,487,497,563,501,465,447,469,
  266.                 488,520,476,593,553,513,512,577,592,
  267.                 511,464,519,460: result = model;
  268.         default: result = 0;
  269.     }
  270.         return result;
  271. }
  272.  
  273. stock DestroyAllXenon()
  274. {
  275.         for(new i = 0; i < MAX_VEHICLES; i++)
  276.         {
  277.                 for(new x; x < sizeof(xenonazul); x++)
  278.                 {
  279.                         DestroyObject(xenonazul[x][i]);
  280.                 }
  281.                 for(new x; x < sizeof(xenonverde); x++)
  282.                 {
  283.                         DestroyObject(xenonverde[x][i]);
  284.                 }
  285.                 for(new x; x < sizeof(xenonvermelho); x++)
  286.                 {
  287.                         DestroyObject(xenonvermelho[x][i]);
  288.                 }
  289.                 for(new x; x < sizeof(xenonbranco); x++)
  290.                 {
  291.                         DestroyObject(xenonbranco[x][i]);
  292.                 }
  293.         }
  294. }
Advertisement
Add Comment
Please, Sign In to add comment