Advertisement
Guest User

Simple C$

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