Share Pastebin
Guest
Public paste!

J_B

By: a guest | Jun 24th, 2008 | Syntax: None | Size: 9.24 KB | Hits: 67 | Expires: Never
Copy text to clipboard
  1.  
  2. #include <a_samp>
  3.  
  4. #define nolanzado 0
  5. #define lanzado 1
  6. #define COLOR_BLUE 0x0000BBAA
  7.  
  8. new BOMBER;
  9. new bomba[5];
  10. //new timer;
  11. new lebomb2;
  12. new lebomb3;
  13. new lebomb4;
  14. new lebomb5;
  15. new check;
  16. //new pickup;
  17.  
  18. new stado;
  19. new Text:status;
  20.  
  21.  
  22. forward isinbomber();
  23. forward GameModeExitFunc();
  24. forward explode();
  25. forward timeractivar();
  26. forward barraoff();
  27. forward bomba2();
  28. forward bomba3();
  29. forward bomba4();
  30. forward bomba5();
  31.  
  32. forward pickupon();
  33. forward pickupoff();
  34.  
  35. main()
  36.  
  37. {
  38.  
  39.         print("\n----------------------------------");
  40.  
  41.         print("  JB [Der Kommandant] BOMBER");
  42.  
  43.         print("----------------------------------\n");
  44.  
  45. }
  46.  
  47.  
  48.  
  49. //---------------------------------------------------------
  50.  
  51.  
  52.  
  53. public OnGameModeInit()
  54.  
  55. {
  56.         //BOMBER = AddStaticVehicle(553,3588.5298,-1919.7592,18.7809,272.3137,1,1);
  57.         BOMBER = AddStaticVehicle(553,-1650.8331,-157.7801,15.4887,316.2009,1,1);
  58.         /*timer = */
  59.         SetTimer("isinbomber",500,true);
  60.         SetTimer("barraoff", 250, true);
  61.  
  62.         status = TextDrawCreate(588.000000,425.000000,"Bombs");
  63.         TextDrawUseBox(status,1);
  64.         TextDrawBoxColor(status,0x0000ffff);
  65.         TextDrawTextSize(status,-47.000000,-83.000000);
  66.         TextDrawAlignment(status,2);
  67.         TextDrawBackgroundColor(status,0x0000ffcc);
  68.         TextDrawFont(status,3);
  69.         TextDrawLetterSize(status,0.499999,1.200000);
  70.         TextDrawColor(status,0xffffffff);
  71.         TextDrawSetOutline(status,1);
  72.         TextDrawSetProportional(status,1);
  73.         TextDrawSetShadow(status,2);
  74.        
  75.         return 1;
  76.  
  77. }
  78.  
  79.  
  80.  
  81. //---------------------------------------------------------
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. //---------------------------------------------------------
  90.  
  91.  
  92.  
  93. public OnPlayerConnect(playerid)
  94.  
  95. {
  96.  
  97.  
  98.  
  99.         return 1;
  100.  
  101. }
  102.  
  103.  
  104.  
  105. //---------------------------------------------------------
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112. //---------------------------------------------------------
  113.  
  114.  
  115.  
  116. public OnPlayerRequestClass(playerid, classid)
  117.  
  118. {
  119.  
  120.  
  121.  
  122.         return 1;
  123.  
  124. }
  125.  
  126.  
  127.  
  128. //---------------------------------------------------------
  129.  
  130.  
  131.  
  132. public OnPlayerSpawn(playerid)
  133.  
  134. {
  135.  
  136.        
  137.         return 1;
  138.  
  139. }
  140.  
  141.  
  142.  
  143. //---------------------------------------------------------
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. //---------------------------------------------------------
  151.  
  152.  
  153.  
  154. public OnPlayerEnterCheckpoint(playerid) {
  155.  
  156.        
  157.  
  158.         return 1;
  159.  
  160. }
  161.  
  162.  
  163.  
  164. //---------------------------------------------------------
  165.  
  166.  
  167.  
  168. public OnPlayerDeath(playerid, killerid, reason)
  169.  
  170. {
  171.  
  172.  
  173.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  174.         TextDrawHideForPlayer(playerid,status);
  175.  
  176.         }
  177.  
  178.  
  179.         return 1;
  180.  
  181. }
  182.  
  183.  
  184.  
  185. //---------------------------------------------------------
  186.  
  187.  
  188.  
  189.  
  190.  
  191. //---------------------------------------------------------
  192.  
  193.  
  194.  
  195. public GameModeExitFunc()
  196.  
  197. {
  198.  
  199.         GameModeExit();
  200.  
  201. }
  202.  
  203.  
  204. //------------------------------------------------------------------------------------
  205.  
  206. /*public isinbomber()
  207. {
  208.  
  209.  
  210. for(new playerid=0;playerid<MAX_PLAYERS;playerid++)
  211.  
  212.         {
  213.        
  214.         new keys, updown, leftright;
  215.         GetPlayerKeys(playerid, keys, updown, leftright);
  216.  
  217.  
  218.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  219.         if( ((keys & KEY_FIRE) == KEY_FIRE) || ((keys & KEY_ACTION) == KEY_ACTION) ) {
  220.               new Float:x,Float:y,Float:z;
  221.               GetPlayerPos(playerid,x,y,z);
  222.                           bomba = CreateObject(1636,x,y,z-1,75,0,0);
  223.                           MoveObject(bomba,x,y,z-20,12.0);
  224.                           SetTimer("explode", 2900, false);
  225.                           return 1;
  226.                           }
  227.                                
  228.                 }
  229.        
  230. }
  231. return 1;
  232. }*/
  233.  
  234.  
  235.  
  236. public explode()
  237. {
  238.  
  239.         new Float:x,Float:y,Float:z;
  240.         new Float:a,Float:b,Float:c; //lebomb 2
  241.         new Float:d,Float:e,Float:f; //lebomb 3
  242.         new Float:g,Float:h,Float:i; //lebomb 4
  243.         new Float:j,Float:k,Float:l; //lebomb 5
  244.        
  245.         new Float:m,Float:n,Float:o; //bomba secundaria 1
  246.         new Float:p,Float:q,Float:r; //bomba secundaria 2
  247.         new Float:s,Float:t,Float:u; //bomba secundaria 3
  248.         new Float:v,Float:w,Float:ab; //bomba secundaria 4
  249.        
  250.         GetObjectPos(bomba[0],x,y,z);
  251.         GetObjectPos(bomba[1],m,n,o);
  252.         GetObjectPos(bomba[2],p,q,r);
  253.         GetObjectPos(bomba[3],s,t,u);
  254.         GetObjectPos(bomba[4],v,w,ab);
  255.        
  256.         GetObjectPos(lebomb2,a,b,c);
  257.         GetObjectPos(lebomb3,d,e,f);
  258.         GetObjectPos(lebomb4,g,h,i);
  259.         GetObjectPos(lebomb5,j,k,l);
  260.        
  261.         CreateExplosion(x,y,z,7,400.0);
  262.        
  263.         CreateExplosion(x+random(15),y+random(15),z+random(15),7,400.0);
  264.         CreateExplosion(m,n,o,7,400.0);
  265.         CreateExplosion(m+random(3),n+random(15),o+random(15),7,400.0);
  266.         CreateExplosion(p,q,r,7,400.0);
  267.         CreateExplosion(p+random(15),q+random(15),r+random(15),7,400.0);
  268.         CreateExplosion(s,t,u,7,400.0);
  269.         CreateExplosion(s+random(15),t+random(15),u+random(15),7,400.0);
  270.         CreateExplosion(v,w,ab,7,400.0);
  271.         CreateExplosion(v+random(15),w+random(15),ab+random(15),7,400.0);
  272.        
  273.        
  274.         CreateExplosion(a,b,c,10,400.0);
  275.         CreateExplosion(a+random(15),b+random(15),c+random(15),7,400.0);
  276.         CreateExplosion(d,e,f,6,400.0);
  277.         CreateExplosion(d+random(15),e+random(15),f+random(15),7,400.0);
  278.         CreateExplosion(g,h,i,0,400.0);
  279.         CreateExplosion(g+random(15),h+random(15),i+random(15),7,400.0);
  280.         CreateExplosion(j,k,l,7,400.0);
  281.         CreateExplosion(j+random(15),k+random(15),l+random(15),7,400.0);
  282.        
  283.        
  284.         DestroyObject(bomba[0]);
  285.         DestroyObject(bomba[1]);
  286.         DestroyObject(bomba[2]);
  287.         DestroyObject(bomba[3]);
  288.         DestroyObject(bomba[4]);
  289.        
  290.         DestroyObject(lebomb2);
  291.         DestroyObject(lebomb3);
  292.         DestroyObject(lebomb4);
  293.         DestroyObject(lebomb5);
  294.         DestroyObject(1636);
  295.  
  296.         for(new maxbomba=0;maxbomba<MAX_OBJECTS;maxbomba++)
  297.         {
  298.         DestroyObject(1636);
  299.         DestroyObject(bomba[0]);
  300.         DestroyObject(lebomb2);
  301.         DestroyObject(lebomb3);
  302.         DestroyObject(lebomb4);
  303.         DestroyObject(lebomb5);
  304.         }
  305.     return 1;
  306. }
  307.  
  308. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  309.  
  310.         new keys, updown, leftright;
  311.         GetPlayerKeys(playerid, keys, updown, leftright);
  312.         if(stado==nolanzado){
  313.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  314.        
  315.         if( ((keys & KEY_FIRE) == KEY_FIRE) || ((keys & KEY_ACTION) == KEY_ACTION) ) {
  316.  
  317.  
  318.               new Float:x,Float:y,Float:z; //bomba 1
  319.               GetPlayerPos(playerid,x,y,z);
  320.                           bomba[0] = CreateObject(1636,x,y,z-1.00,75,0,0);
  321.                           bomba[1] = CreateObject(1636,x,y,z-2.50,75,0,0);
  322.                           bomba[2] = CreateObject(1636,x,y,z-3.50,75,0,0);
  323.                           bomba[3] = CreateObject(1636,x,y,z-4.75,75,0,0);
  324.                           bomba[4] = CreateObject(1636,x,y,z-6.00,75,0,0);
  325.                           MoveObject(bomba[0],x,y,z-200,7);
  326.                           MoveObject(bomba[1],x,y,z-200,7);
  327.                           MoveObject(bomba[2],x,y,z-200,7);
  328.                           MoveObject(bomba[3],x,y,z-200,7);
  329.                           MoveObject(bomba[4],x,y,z-200,7);
  330.                          
  331.                           SetTimer("explode", 5000, false);
  332.                           SetTimer("timeractivar", 6000, false);
  333.                           stado = lanzado;
  334.                          
  335.                           SetTimer("bomba2", 1000, false);
  336.                           SetTimer("bomba3", 2000, false);
  337.                           SetTimer("bomba4", 3000, false);
  338.                           SetTimer("bomba5", 4000, false);
  339.                          
  340.                           TextDrawHideForPlayer(playerid,status);
  341.  
  342.                 }
  343. }
  344. }
  345.         else{
  346.  
  347.         }
  348. }
  349.  
  350. public timeractivar()
  351. {
  352.        
  353.     for(new playerid;playerid<MAX_PLAYERS;playerid++){
  354.     if(IsPlayerInVehicle(playerid, BOMBER)) {
  355.     TextDrawShowForPlayer(playerid,status);
  356.     new Float:x,Float:y,Float:z;
  357.     GetPlayerPos(playerid,x,y,z);
  358.     check = AttachPlayerObjectToPlayer(playerid,1317,playerid,x,y,z-10,0,0,0);
  359.     //AttachObjectToPlayer(1317,playerid,x,y,z+1,0,0,0);
  360.     //AttachPlayerObjectToPlayer(playerid,1317,playerid,x,y,z-5,0,0,0);
  361.     //SetTimer("pickupoff",99,true);
  362.         //SetTimer("pickupon",100,true);
  363.    
  364.     }
  365.     }
  366.         stado = nolanzado;
  367.         return stado;
  368.        
  369. }
  370.  
  371. public barraoff(){
  372.         for(new playerid;playerid<MAX_PLAYERS;playerid++){
  373.        
  374.         if(!IsPlayerInVehicle(playerid, BOMBER)) {
  375.         TextDrawHideForPlayer(playerid,status);
  376.         DestroyObject(check);
  377.         }
  378.         }
  379.         }
  380.        
  381. public bomba2(){
  382.  
  383.         for(new playerid=0;playerid<MAX_PLAYERS;playerid++){
  384.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  385.     new Float:x,Float:y,Float:z; //bomba 2
  386.     GetPlayerPos(playerid,x,y,z);
  387.         lebomb2 = CreateObject(1636,x,y,z-1,75,0,0);
  388.         MoveObject(lebomb2,x,y,z-125,7);
  389.         }
  390.         }
  391. }
  392.        
  393. public bomba3(){
  394.         for(new playerid=0;playerid<MAX_PLAYERS;playerid++){
  395.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  396.     new Float:x,Float:y,Float:z; //bomba 2
  397.     GetPlayerPos(playerid,x,y,z);
  398.         lebomb3 = CreateObject(1636,x,y,z-1,75,0,0);
  399.         MoveObject(lebomb3,x,y,z-50,7);
  400.         }
  401.         }
  402. }
  403.        
  404. public bomba4(){
  405.         for(new playerid=0;playerid<MAX_PLAYERS;playerid++){
  406.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  407.        
  408.     new Float:x,Float:y,Float:z; //bomba 2
  409.     GetPlayerPos(playerid,x,y,z);
  410.         lebomb4 = CreateObject(1636,x,y,z-1,75,0,0);
  411.         MoveObject(lebomb4,x,y,z-100,12);
  412.         }
  413.         }
  414. }
  415.        
  416. public bomba5(){
  417.         for(new playerid=0;playerid<MAX_PLAYERS;playerid++){
  418.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  419.     new Float:x,Float:y,Float:z; //bomba 2
  420.     GetPlayerPos(playerid,x,y,z);
  421.         lebomb5 = CreateObject(1636,x,y,z-1,75,0,0);
  422.         MoveObject(lebomb5,x,y,z-150,7);
  423.         }
  424.         }
  425. }
  426.  
  427. /*public pickupon(){
  428.         for(new playerid=0;playerid<MAX_PLAYERS;playerid++){
  429.         if(IsPlayerInVehicle(playerid, BOMBER)) {
  430.     new Float:x,Float:y,Float:z; //pickup
  431.     GetPlayerPos(playerid,x,y,z);
  432.     pickup=CreatePickup ( 1210, 3, x, y, z-5 );
  433.         }
  434.         }
  435. }
  436.  
  437. public pickupoff(){
  438.         DestroyPickup(pickup);
  439. }*/
  440.        
  441.        
  442.        
  443.         /*if(stado==nolanzado){
  444.         TextDrawShowForPlayer(playerid,status);
  445.  
  446.         }
  447.         else{TextDrawHideForPlayer(playerid,status);}
  448.  
  449.         }
  450.         else{TextDrawHideForPlayer(playerid,status);}
  451.  
  452.         switch (stado){
  453.         case lanzado:{
  454.     TextDrawHideForPlayer(playerid,status);
  455.         }
  456.         case nolanzado:{
  457.     TextDrawShowForPlayer(playerid,status);
  458.         }
  459.        
  460.         }*/