Advertisement
D4RkSiD3

[FS] New Bullet Hole with Command & Timer for remove

Dec 20th, 2015
1,431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.71 KB | None | 0 0
  1. /*
  2. English:
  3. • NO Post this filterscript elsewhere SAMP and pose as the creator of the code. • • -> Code Created By d4rk$iD3 <-
  4. • CREDITS • -> d4rk$iD3: Development and idea of the code.
  5. • You can make your modified freely as long as you're respecting and keeping credit.
  6. •  system details:
  7.  a) 2 colors were made to messages on and off by command.
  8.  b) the enumeration for the data to be stored is made.
  9.  c) a timer that automatically updates, passing nine seconds was made all the holes created (you can change the timer to your taste) will be deleted.
  10.  d) command on/off system was made.
  11.  e) the condition of weapons that can open holes in objects in the OnPlayerWeaponShot function is made.
  12.  f) a function of hole Created from bullets and another was made to clear all.
  13.  
  14. IMPORTANT !!!  READ CAREFULLY TO AVOID become a thief spaces ABSOLUTELY the Credit Theft or publication of This filterscript without my permission.
  15.  
  16. Spanish:
  17.     • NO Publicar este FILTERSCRIPT en otros foros de SA-MP y hacerse pasar por el creador del código.
  18.     •
  19.     • -> Código Creado Por D4Rk$iD3 <-
  20.     •
  21.     • CREDITOS:
  22.     •     -> D4Rk$iD3: Desarrollo e idea del código.
  23.     •     Puedes hacer Tu modificacion libremente siempre y cuándo estés respetando y manteniendo los créditos.
  24.     •
  25.     •
  26.     •     •     •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •
  27.     •
  28.     • Detalles del sitema:
  29.     •                   a) Se hicieron 2 colores para mensajes de activación y desactivación por comando.
  30.     •                     b) Se hicieron las enumeraciones para los datos que serán almacenados.
  31.     •                   c) Se hizo un timer que se actualiza automáticamente, al pasar 9 segundos se borrarán todos los orificios creados (Puedes cambiar el timer a tu gusto).
  32.     •                     d) Se hizo el comando de activación/desactivación del sistema.
  33.     •                     e) Se hizo la condición para las armas que podrán abrir orificios en objetos en la función                       OnPlayerWeaponShot.
  34.     •                   f) Se hizo una función de Creado de Orificio de las balas y otra para Borrarlas todas.
  35.     •         •       •       •       •      •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •       •
  36.     • ¡¡¡ IMPORTANTE !!!
  37.     • LEE ATENTAMENTE PARA NO VOLVERTE UN LADRÓN.
  38.     •••••••••••••••••••••••••••
  39.     • Prohibido             •
  40.     • ABSOLUTAMENTE         •
  41.     • el                    •
  42.     • Robo                  •
  43.     • de Créditos              •
  44.     • o la publicación         •
  45.     • de este FILTERSCRIPT  •
  46.     • sin MI AUTORIZACIÓN.  •
  47.     •••••••••••••••••••••••••••
  48. */
  49. #define FILTERSCRIPT
  50.  
  51. #include <streamer>
  52.  
  53. #if defined FILTERSCRIPT
  54. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
  55. //Colores
  56. #define green                  0x33FF33AA
  57. #define red                    0xFF0000AA
  58. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
  59. enum Datos
  60. {
  61.     Creado,
  62.     Objeto,
  63.     Contador,
  64.     Float:X1,
  65.     Float:Y1,
  66.     Float:Z1,
  67. };
  68. #define Maximos_Disparos (500)
  69. new DatosH[Maximos_Disparos][Datos], bullethole[MAX_PLAYERS], timer2;
  70.  
  71. public OnFilterScriptInit()
  72. {
  73.     timer2 = SetTimer("BorrarTodosLosAgujeros", 9000, 1);
  74.     print("\n--------------------------------------");
  75.     print(" BulletHole V1 Filterscript by D4Rk$iD3, Saludos PawnoScript!");
  76.     print("--------------------------------------\n");
  77.     for(new i; i < Maximos_Disparos; i++) { i = 0; return 1;}
  78.     return 1;
  79. }
  80.  
  81. public OnFilterScriptExit()
  82. {
  83.     KillTimer(timer2);
  84.     return 1;
  85. }
  86. #endif
  87.  
  88. public OnPlayerConnect(playerid)
  89. {
  90.     bullethole[playerid] = 0;
  91.     return 1;
  92. }
  93.  
  94. public OnPlayerDisconnect(playerid, reason)
  95. {
  96.     bullethole[playerid] = 0;
  97.     return 1;
  98. }
  99.  
  100. public OnPlayerSpawn(playerid)
  101. {
  102.     bullethole[playerid] = 0;
  103.     GivePlayerWeapon(playerid,30,1000);
  104.     GivePlayerWeapon(playerid,38,1000);
  105.     GivePlayerWeapon(playerid,32,1000);
  106.     return 1;
  107. }
  108.  
  109. public OnPlayerCommandText(playerid, cmdtext[])
  110. {
  111. if(strcmp(cmdtext, "/bullethole", true) == 0) {
  112. if(bullethole[playerid] == 0)
  113. {
  114.     bullethole[playerid] = 1;
  115.     SendClientMessage(playerid, green, "[INFO]: Ahora se mostrarán los orificios de las balas al disparar a un objeto.");
  116. }
  117. else if(bullethole[playerid] == 1) {
  118.     bullethole[playerid] = 0;
  119.     SendClientMessage(playerid,red,"[INFO]: Ya no se mostrarán los orificios de las balas al disparar a un objeto.");
  120. }
  121. return 1;
  122. }
  123. return 0;
  124. }
  125.  
  126. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  127. {
  128.     if(bullethole[playerid] == 1) {
  129.             if(hittype == 0 && fX != 0)
  130.             {
  131.                 new Float: A, Float: rX, Float: rY;
  132.                 GetXYInFrontOfPlayer(playerid, rX, rY, 5.0);
  133.                 GetPlayerFacingAngle(playerid, A);
  134.                 CrearAgujero(fX, fY, fZ, rX, rY, A-90);
  135.             }
  136.     }
  137.     return 1;
  138. }
  139.  
  140. forward CrearAgujero(Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:Angle);
  141. public CrearAgujero(Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:Angle)
  142. {
  143.     for(new i = 0; i < sizeof(DatosH); i++)
  144.         {
  145.             if(DatosH[i][Creado] == 0)
  146.             {
  147.             DatosH[i][Creado]=1;
  148.             DatosH[i][X1]=x;
  149.             DatosH[i][Y1]=y;
  150.             DatosH[i][Z1]=z;
  151.             DatosH[i][Objeto] = CreateObject(19185, x, y, z, rx, ry, Angle);
  152.             DatosH[i][Contador] += 1;
  153.             SetObjectMaterial(DatosH[i][Objeto], 0, 19341, "egg_texts", "easter_egg01", 0xFF000000);
  154.             return 1;
  155.             }
  156.       }
  157.     return 0;
  158. }
  159.  
  160. forward BorrarTodosLosAgujeros();
  161. public BorrarTodosLosAgujeros()
  162. {
  163.     for(new i = 0; i < sizeof(DatosH); i++)
  164.         {
  165.             if(DatosH[i][Creado] == 1)
  166.             {
  167.             DatosH[i][Creado]=0;
  168.             DatosH[i][X1]=0.0;
  169.             DatosH[i][Y1]=0.0;
  170.             DatosH[i][Z1]=0.0;
  171.             DatosH[i][Contador] = 0;
  172.             DestroyObject(DatosH[i][Objeto]);
  173.             }
  174.         }
  175.     return 0;
  176. }
  177.  
  178. GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  179. {
  180.     new Float:a;
  181.     GetPlayerPos(playerid, x, y, a);
  182.     GetPlayerFacingAngle(playerid, a);
  183.     if (GetPlayerVehicleID(playerid))
  184.     {
  185.       GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  186.     }
  187.     x += (distance * floatsin(-a, degrees));
  188.     y += (distance * floatcos(-a, degrees));
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement