Advertisement
Guest User

Simple C4 System

a guest
Aug 22nd, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.96 KB | None | 0 0
  1. //=================================================================//
  2. /*
  3.     # Filterscript: C4 Bomb System
  4.     # Author: Itz.Yansi42O
  5.     # Releases: 22.08.2019.
  6. */
  7. //=================================================================//
  8. #include <a_samp>
  9. #include <sscanf2>
  10. #include <PawnPlus>
  11. #include <YSI_Visual\y_commands>
  12. #include <YSI_Data\y_bit>
  13. //=================================================================//
  14. enum BOMB_ENUM {
  15.     Float:vposX,
  16.     Float:vposY,
  17.     Float:vposZ
  18. }
  19.  
  20. new bombInfo[BOMB_ENUM], playerVehicle[MAX_PLAYERS];
  21.  
  22. //y_bit
  23. new BitArray:bombActivated<MAX_PLAYERS>, BitArray:havingBomb<MAX_PLAYERS>;
  24. //=================================================================//
  25. YCMD:activebomb(playerid, const params[], help) {
  26.     if ((!Bit_Get(havingBomb, playerid)) == !(false))
  27.         return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You don't have a bomb!");
  28.  
  29.     if (!IsPlayerInAnyVehicle(playerid))
  30.         return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You must be in vehicle!");
  31.  
  32.     GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~5sec", 1000, 3);
  33.     wait_ms(1000);
  34.     GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~4sec", 1000, 3);
  35.     wait_ms(1000);
  36.     GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~3sec", 1000, 3);
  37.     wait_ms(1000);
  38.     GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~2sec", 1000, 3);
  39.     wait_ms(1000);
  40.     GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~1sec", 1000, 3);
  41.     wait_ms(1000);
  42.  
  43.     SendClientMessage(playerid, 0x0070D0FF, "[SERVER]: {FFFFFF}To activate bomb press Y!");
  44.  
  45.     Bit_Set(bombActivated, playerid, true);
  46.  
  47.     playerVehicle[playerid] = GetPlayerVehicleID(playerid);
  48.  
  49.     new Float:x, Float:y, Float:z;
  50.     GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  51.     bombInfo[vposX] = x, bombInfo[vposY] = y, bombInfo[vposZ] = z;
  52.     return 1;
  53. }
  54.  
  55. YCMD:bomb(playerid, const params[], help) {
  56.     if ((Bit_Get(havingBomb, playerid)) == (true))
  57.         return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You already have a bomb!");
  58.  
  59.     Bit_Set(havingBomb, playerid, true);
  60.     return 1;
  61. }
  62.  
  63. YCMD:veh(playerid, const params[], help) {
  64.     new Float:x, Float:y, Float:z, Float:a;
  65.     GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
  66.  
  67.     CreateVehicle(411, x, y, z, a, 1, 1, 0, 1);
  68.     return 1;
  69. }
  70. //=================================================================//
  71. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
  72.     if (newkeys & KEY_YES) {
  73.         if ((!Bit_Get(bombActivated, playerid)) == !(false))
  74.             return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You did not plant a bomb in any vehicle!");
  75.  
  76.         SetVehicleHealth(playerVehicle[playerid], 0.0);
  77.         wait_ms(4000);
  78.         CreateExplosion(bombInfo[vposX], bombInfo[vposY], bombInfo[vposZ], 2, 20.0);
  79.  
  80.         Bit_Set(bombActivated, playerid, false);
  81.         Bit_Set(havingBomb, playerid, false);
  82.         bombInfo[vposX] = 0.0, bombInfo[vposY] = 0.0, bombInfo[vposZ] = 0.0;
  83.     }
  84.     return 1;
  85. }
  86. //=================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement