Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=================================================================//
- /*
- # Filterscript: C4 Bomb System
- # Author: Itz.Yansi42O
- # Releases: 22.08.2019.
- */
- //=================================================================//
- #include <a_samp>
- #include <sscanf2>
- #include <PawnPlus>
- #include <YSI_Visual\y_commands>
- #include <YSI_Data\y_bit>
- //=================================================================//
- enum BOMB_ENUM {
- Float:vposX,
- Float:vposY,
- Float:vposZ
- }
- new bombInfo[BOMB_ENUM], playerVehicle[MAX_PLAYERS];
- //y_bit
- new BitArray:bombActivated<MAX_PLAYERS>, BitArray:havingBomb<MAX_PLAYERS>;
- //=================================================================//
- YCMD:activebomb(playerid, const params[], help) {
- if ((!Bit_Get(havingBomb, playerid)) == !(false))
- return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You don't have a bomb!");
- if (!IsPlayerInAnyVehicle(playerid))
- return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You must be in vehicle!");
- GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~5sec", 1000, 3);
- wait_ms(1000);
- GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~4sec", 1000, 3);
- wait_ms(1000);
- GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~3sec", 1000, 3);
- wait_ms(1000);
- GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~2sec", 1000, 3);
- wait_ms(1000);
- GameTextForPlayer(playerid, "~y~PLANTING BOMB: ~r~1sec", 1000, 3);
- wait_ms(1000);
- SendClientMessage(playerid, 0x0070D0FF, "[SERVER]: {FFFFFF}To activate bomb press Y!");
- Bit_Set(bombActivated, playerid, true);
- playerVehicle[playerid] = GetPlayerVehicleID(playerid);
- new Float:x, Float:y, Float:z;
- GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
- bombInfo[vposX] = x, bombInfo[vposY] = y, bombInfo[vposZ] = z;
- return 1;
- }
- YCMD:bomb(playerid, const params[], help) {
- if ((Bit_Get(havingBomb, playerid)) == (true))
- return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You already have a bomb!");
- Bit_Set(havingBomb, playerid, true);
- return 1;
- }
- YCMD:veh(playerid, const params[], help) {
- new Float:x, Float:y, Float:z, Float:a;
- GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a);
- CreateVehicle(411, x, y, z, a, 1, 1, 0, 1);
- return 1;
- }
- //=================================================================//
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
- if (newkeys & KEY_YES) {
- if ((!Bit_Get(bombActivated, playerid)) == !(false))
- return SendClientMessage(playerid, 0xFF0000AA, "(ERROR): {FFFFFF}You did not plant a bomb in any vehicle!");
- SetVehicleHealth(playerVehicle[playerid], 0.0);
- wait_ms(4000);
- CreateExplosion(bombInfo[vposX], bombInfo[vposY], bombInfo[vposZ], 2, 20.0);
- Bit_Set(bombActivated, playerid, false);
- Bit_Set(havingBomb, playerid, false);
- bombInfo[vposX] = 0.0, bombInfo[vposY] = 0.0, bombInfo[vposZ] = 0.0;
- }
- return 1;
- }
- //=================================================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement