Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // CAR BOMBS v1.0
- // by Lenny
- //
- // CONFIGURATION
- //
- #define FILTERSCRIPT
- #define CB_COLOR_GREY 0xAFAFAF00
- #define CB_COLOR_WHITE 0xFFFFFFAA
- #define CB_COLOR_FADE1 0xE6E6E6E6
- #define CB_COLOR_FADE3 0xAAAAAAAA
- #define CB_COLOR_GREEN 0x33AA33AA
- #define CB_COLOR_RED 0xAA3333AA
- #define CB_COLOR_LIGHTRED 0xFF6347AA
- #define BOMB_ARMTIME 15 // Amount of seconds it takes to arm a bomb
- #define BOMB_CHECKTIME 10 // Amount of seconds it takes to check for bombs in a vehicle
- #define BOMB_DISARMTIME 5 // Amount of seconds it takes to attempt to disarm a bomb
- #define BOMB_USE_DISTANCE 3.0 // FLOAT, how far away the player has to be from the vehicle to use any bombs
- stock PlayerHasCarBomb(playerid)
- {
- // Write your code to check if the player has a bomb
- #pragma unused playerid // Don't forget to remove this line
- return 1;
- }
- stock CanPlayerDisarmBomb(playerid)
- {
- // Write your code to check if the player can disarm a bomb (Like if he is a police or something)
- #pragma unused playerid // Don't forget to remove this line
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- #pragma unused playerid, ispassenger
- CarBomb_OnVehicleStart(vehicleid); // Move this some place else if you have a different technique of starting vehicles
- }
- //
- // CONFIGURATION END
- #include <a_samp>
- #include <zcmd>
- #include <strtok>
- main() {}
- stock Float:GetVehicleSpeed(vehicleid)
- {
- new
- Float: speed_x,
- Float: speed_y,
- Float: speed_z,
- Float: temp_speed;
- GetVehicleVelocity(vehicleid, speed_x, speed_y, speed_z);
- temp_speed = floatsqroot( ( (speed_x * speed_x ) + ( speed_y * speed_y ) ) + ( speed_z * speed_z ) ) * 136.666667;
- return temp_speed;
- }
- // Bomb types
- #define VEHICLE_BOMB_TYPE_UNARMED 0
- #define VEHICLE_BOMB_TYPE_IGNITION 1
- #define VEHICLE_BOMB_TYPE_TIMER 2
- #define VEHICLE_BOMB_TYPE_SPEED 3
- #define VEHICLE_BOMB_TYPE_REMOTE 4
- // Timers
- forward PlayerPutBombInVehicle(seconds, playerid, vehicleid, bomb_type, bomb_timer);
- forward BombActivated(vehicleid);
- forward ArmSpeedBomb(vehicleid);
- forward CheckForBombs(playerid, vehicleid);
- forward DisarmBomb(playerid, vehicleid);
- enum e_Bomb_Vehicles
- {
- bv_i_ArmedType,
- bv_i_ExplosionTimer,
- bv_i_BombOwner,
- bool: bv_b_BombActivated,
- bool: bv_b_BombDisarmed
- };
- new
- g_Bomb_Vehicles[MAX_VEHICLES][e_Bomb_Vehicles];
- stock ResetBombInfo(vehicleid)
- {
- g_Bomb_Vehicles[vehicleid][bv_i_ArmedType] = 0;
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] = 0;
- g_Bomb_Vehicles[vehicleid][bv_i_BombOwner] = 0;
- g_Bomb_Vehicles[vehicleid][bv_b_BombActivated] = false;
- g_Bomb_Vehicles[vehicleid][bv_b_BombDisarmed] = false;
- }
- public DisarmBomb(playerid, vehicleid)
- {
- DeletePVar(playerid, "DisarmingBomb");
- new
- Float: f_vPos[3];
- GetVehiclePos(vehicleid, f_vPos[0], f_vPos[1], f_vPos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are not close enough to the vehicle anymore.");
- return 1;
- }
- ResetBombInfo(vehicleid);
- g_Bomb_Vehicles[vehicleid][bv_b_BombDisarmed] = true;
- SendClientMessage(playerid, CB_COLOR_GREEN, "You have disarmed the bomb.");
- return 1;
- }
- public CheckForBombs(playerid, vehicleid)
- {
- DeletePVar(playerid, "CheckingForBombs");
- SetPVarInt(playerid, "CheckedCarForBombs", vehicleid);
- new
- Float: f_vPos[3];
- GetVehiclePos(vehicleid, f_vPos[0], f_vPos[1], f_vPos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are not close enough to the vehicle anymore.");
- return 1;
- }
- if(g_Bomb_Vehicles[vehicleid][bv_i_ArmedType])
- {
- SendClientMessage(playerid, CB_COLOR_RED, "You have found an armed bomb inside the vehicle!");
- if(g_Bomb_Vehicles[vehicleid][bv_b_BombActivated])
- {
- SendClientMessage(playerid, CB_COLOR_LIGHTRED, "WARNING! THE BOMB IS ACTIVE AND ABOUT TO BLOW!");
- }
- SetPVarInt(playerid, "FoundBombInCar", vehicleid);
- }
- else if(g_Bomb_Vehicles[vehicleid][bv_b_BombDisarmed])
- {
- SendClientMessage(playerid, CB_COLOR_GREEN, "You have found a disarmed bomb.");
- }
- else
- {
- SendClientMessage(playerid, CB_COLOR_GREEN, "You didn't find any bombs.");
- }
- return 1;
- }
- stock CarBomb_OnVehicleStart(vehicleid)
- {
- if(g_Bomb_Vehicles[vehicleid][bv_i_ArmedType] != VEHICLE_BOMB_TYPE_UNARMED && g_Bomb_Vehicles[vehicleid][bv_b_BombActivated] == false)
- {
- switch(g_Bomb_Vehicles[vehicleid][bv_i_ArmedType])
- {
- case VEHICLE_BOMB_TYPE_IGNITION:
- {
- BombActivated(vehicleid);
- return 1;
- }
- case VEHICLE_BOMB_TYPE_SPEED:
- {
- SetTimerEx("ArmSpeedBomb", g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] * 1000, false, "d", vehicleid);
- return 1;
- }
- }
- }
- return 1;
- }
- public ArmSpeedBomb(vehicleid)
- {
- if(GetVehicleSpeed(vehicleid) < 40.0)
- {
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] = 2;
- BombActivated(vehicleid);
- return 1;
- }
- SetTimerEx("ArmSpeedBomb", 400, 0, "d", vehicleid);
- return 1;
- }
- public BombActivated(vehicleid)
- {
- if(g_Bomb_Vehicles[vehicleid][bv_b_BombDisarmed])
- {
- return 1;
- }
- if(!g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer])
- {
- ExplodeVehicleBomb(vehicleid);
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer]--;
- SetTimerEx("BombActivated", 400, 0, "d", vehicleid);
- return 1;
- }
- new
- Float: f_Pos[3];
- GetVehiclePos(vehicleid, f_Pos[0], f_Pos[1], f_Pos[2]);
- if(g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] < 0)
- {
- CreateExplosion(f_Pos[0], f_Pos[1], f_Pos[2], 4, 2.0); // Extra effects
- CreateExplosion(f_Pos[0], f_Pos[1], f_Pos[2], 5, 2.0); // Extra effects
- if(g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] == -2)
- {
- CreateExplosion(f_Pos[0], f_Pos[1], f_Pos[2], 1, 2.0); // Small explosion
- }
- if(g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] < -3)
- {
- return 1;
- }
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer]--;
- SetTimerEx("BombActivated", 400, 0, "d", vehicleid);
- return 1;
- }
- g_Bomb_Vehicles[vehicleid][bv_b_BombActivated] = true;
- if(g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] == 1)
- {
- PlayVehicleBombSound(vehicleid, 17803); // Clicking sound
- }
- if(g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] == 2)
- {
- PlayVehicleBombSound(vehicleid, 6400); // Digital sound
- }
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer]--;
- SetTimerEx("BombActivated", 1000, 0, "d", vehicleid);
- return 1;
- }
- public PlayerPutBombInVehicle(seconds, playerid, vehicleid, bomb_type, bomb_timer)
- {
- if(!seconds)
- {
- TogglePlayerControllable(playerid, 1);
- new
- Float: f_Pos[3];
- GetVehiclePos(vehicleid, f_Pos[0], f_Pos[1], f_Pos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_Pos[0], f_Pos[1], f_Pos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You are not close enough to this vehicle anymore.");
- return 1;
- }
- g_Bomb_Vehicles[vehicleid][bv_i_ArmedType] = bomb_type;
- g_Bomb_Vehicles[vehicleid][bv_i_ExplosionTimer] = bomb_timer;
- g_Bomb_Vehicles[vehicleid][bv_i_BombOwner] = playerid;
- if(bomb_type == VEHICLE_BOMB_TYPE_TIMER)
- {
- //SetTimerEx("BombActivated", 1000, 0, "d", vehicleid);
- BombActivated(vehicleid);
- }
- DeletePVar(playerid, "PuttingBomb");
- SendClientMessage(playerid, CB_COLOR_GREEN, "You have planted and armed the bomb.");
- GameTextForPlayer(playerid, "~r~Bomb armed", 2000, 3);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- new
- szString[69];
- format(szString, sizeof(szString), "~g~Arming bomb...~n~~r~%d ~n~ ~y~Type ~r~/bomb put~y~ again to stop", seconds);
- GameTextForPlayer(playerid, szString, 2000, 3);
- SetPVarInt(playerid, "PuttingBomb", SetTimerEx("PlayerPutBombInVehicle", 1000, 0, "ddddd", seconds - 1, playerid, vehicleid, bomb_type, bomb_timer));
- return 1;
- }
- stock ExplodeVehicleBomb(vehicleid)
- {
- SetVehicleHealth(vehicleid, 50.0);
- new
- Float: f_vPos[3];
- GetVehiclePos(vehicleid, f_vPos[0], f_vPos[1], f_vPos[2]);
- CreateExplosion(f_vPos[0], f_vPos[1], f_vPos[2], 4, 5.0); // Extra effects
- CreateExplosion(f_vPos[0], f_vPos[1], f_vPos[2], 5, 5.0); // Extra effects
- CreateExplosion(f_vPos[0], f_vPos[1], f_vPos[2], 6, 5.0); // Big one
- ResetBombInfo(vehicleid);
- }
- CMD:bomb(playerid, params[])
- {
- new
- idx,
- szParameters[2][128 - 6];
- szParameters[0] = strtok(params, idx);
- if(isnull(szParameters[0]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "USAGE: /bomb [Parameter]");
- SendClientMessage(playerid, CB_COLOR_GREY, "Available parameters: {E6E6E6}put{AFAFAF}, {E6E6E6}activate{AFAFAF}");
- if(CanPlayerDisarmBomb(playerid))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "{33CCFF}Disarming parameters{AFAFAF}: {E6E6E6}check{AFAFAF}, {E6E6E6}disarm{AFAFAF}");
- }
- return 1;
- }
- szParameters[1] = strtok(params, idx);
- if(!strcmp(szParameters[0], "put", true, 4))
- {
- new
- BombTimerID = GetPVarInt(playerid, "PuttingBomb"),
- szSetting[20],
- iTimer;
- if(BombTimerID)
- {
- KillTimer(BombTimerID);
- DeletePVar(playerid, "PuttingBomb");
- GameTextForPlayer(playerid, "~r~Stopped arming bomb", 2000, 3);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- if(!PlayerHasCarBomb(playerid))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You don't have a bomb.");
- return 1;
- }
- szSetting = strtok(params, idx);
- iTimer = strval(strtok(params, idx));
- if(isnull(szParameters[1]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "USAGE: /bomb put [{E6E6E6}Vehicle ID{AFAFAF}] [{E6E6E6}Setting{AFAFAF}] [{E6E6E6}Timer (Seconds){AFAFAF}]");
- SendClientMessage(playerid, CB_COLOR_FADE3, "Available settings: {E6E6E6}Ignition, timer, speed, remote"),
- SendClientMessage(playerid, CB_COLOR_GREY, "NOTE: Use \"{E6E6E6}/bomb put help{AFAFAF}\" for explinations of use.");
- return 1;
- }
- if(!strcmp(szParameters[1], "help", true, 5))
- {
- SendClientMessage(playerid, CB_COLOR_WHITE, "[ BOMB PUT MANUAL ]");
- SendClientMessage(playerid, CB_COLOR_WHITE, "Setting 1: IGNITION {AAAAAA}- Activates the bomb timer after the {E6E6E6}vehicle's ignition{AAAAAA} is activated.");
- SendClientMessage(playerid, CB_COLOR_WHITE, "Setting 2: TIMER {AAAAAA}- {E6E6E6}Immediately{AAAAAA} activates the bomb timer.");
- SendClientMessage(playerid, CB_COLOR_WHITE, "Setting 3: SPEED {AAAAAA}- The bomb will explode as soon as the {E6E6E6}vehicle speed{AAAAAA}");
- SendClientMessage(playerid, CB_COLOR_FADE3, "drops under {E6E6E6}40{AAAAAA} km/h. It is activated {E6E6E6}as soon as the vehicle is started{AAAAAA}.");
- SendClientMessage(playerid, CB_COLOR_WHITE, "Setting 4: REMOTE {AAAAAA}- Bomb is activated with \"{E6E6E6}/bomb activate{AAAAAA}\". Note that the {E6E6E6}remote range is limited{AAAAAA}.");
- SendClientMessage(playerid, CB_COLOR_WHITE, "The timer: {AAAAAA}- Decides how long it takes for the bomb to {E6E6E6}detonate{AAAAAA} from the moment it is activated.");
- SendClientMessage(playerid, CB_COLOR_FADE3, "You can get the {E6E6E6}ID{AAAAAA} of the vehicle by using the \"{E6E6E6}/dl{AAAAAA}\" command.");
- SendClientMessage(playerid, CB_COLOR_WHITE, "[ END OF BOMB PUT MANUAL ]");
- return 1;
- }
- if( !GetVehicleModel( strval( szParameters[1] ) ) ) // The car isn't spawned
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid vehicle ID.");
- SendClientMessage(playerid, CB_COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles.");
- return 1;
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it.");
- return 1;
- }
- new
- iVehicleID = strval(szParameters[1]),
- Float: f_Pos[3];
- GetVehiclePos(iVehicleID, f_Pos[0], f_Pos[1], f_Pos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_Pos[0], f_Pos[1], f_Pos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You are not close enough to this vehicle.");
- return 1;
- }
- new
- iSetting;
- if(!strcmp(szSetting, "ignition", true, 9))
- {
- if(iTimer < 1 || iTimer > 60)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}1{AFAFAF} and {E6E6E6}60{AFAFAF} seconds.");
- return 1;
- }
- iSetting = VEHICLE_BOMB_TYPE_IGNITION;
- }
- else if(!strcmp(szSetting, "timer", true, 6))
- {
- if(iTimer < 10 || iTimer > 120)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}10{AFAFAF} and {E6E6E6}120{AFAFAF} seconds.");
- return 1;
- }
- iSetting = VEHICLE_BOMB_TYPE_TIMER;
- }
- else if(!strcmp(szSetting, "speed", true, 6))
- {
- if(iTimer < 15 || iTimer > 60)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}15{AFAFAF} and {E6E6E6}60{AFAFAF} seconds.");
- return 1;
- }
- iSetting = VEHICLE_BOMB_TYPE_SPEED;
- }
- else if(!strcmp(szSetting, "remote", true, 6))
- {
- if(iTimer < 1 || iTimer > 60)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}1{AFAFAF} and {E6E6E6}60{AFAFAF} seconds.");
- return 1;
- }
- iSetting = VEHICLE_BOMB_TYPE_REMOTE;
- }
- else
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid setting. Please refer to manual: \"{E6E6E6}/bomb put help{AFAFAF}\".");
- return 1;
- }
- ResetBombInfo(iVehicleID);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_ARMTIME * 1100, 0);
- SetPVarInt(playerid, "PuttingBomb", SetTimerEx("PlayerPutBombInVehicle", 0, 0, "ddddd", BOMB_ARMTIME, playerid, iVehicleID, iSetting, iTimer));
- return 1;
- }
- if(!strcmp(szParameters[0], "activate", true, 4))
- {
- new
- Float: f_vPos[3],
- iHasAnyRemoteBombs;
- for(new i; i < MAX_VEHICLES; i++)
- {
- if(g_Bomb_Vehicles[i][bv_i_ArmedType] == VEHICLE_BOMB_TYPE_REMOTE && g_Bomb_Vehicles[i][bv_i_BombOwner] == playerid)
- {
- iHasAnyRemoteBombs = 1;
- GetVehiclePos(i, f_vPos[0], f_vPos[1], f_vPos[2]);
- if(IsPlayerInRangeOfPoint(playerid, 100.0, f_vPos[0], f_vPos[1], f_vPos[2]))
- {
- g_Bomb_Vehicles[i][bv_i_BombOwner] = INVALID_PLAYER_ID;
- BombActivated(i);
- }
- }
- }
- if(!iHasAnyRemoteBombs)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You haven't planted any bombs.");
- return 1;
- }
- new
- Float: f_Pos[3];
- GetPlayerPos(playerid, f_Pos[0], f_Pos[1], f_Pos[2]);
- PlayerPlaySound(playerid, 6400, f_Pos[0], f_Pos[1], f_Pos[2]);
- SendClientMessage(playerid, CB_COLOR_GREEN, "You pressed the trigger on your remote to active your bomb(s).");
- SendClientMessage(playerid, CB_COLOR_GREY, "NOTE: The distance for the remote is limited.");
- return 1;
- }
- if(CanPlayerDisarmBomb(playerid))
- {
- if(!strcmp(szParameters[0], "check", true, 4))
- {
- new
- BombCheckingTimerID = GetPVarInt(playerid, "CheckingForBombs");
- if(BombCheckingTimerID)
- {
- KillTimer(BombCheckingTimerID);
- DeletePVar(playerid, "CheckingForBombs");
- GameTextForPlayer(playerid, "~r~Stopped looking for bombs", 2000, 3);
- return 1;
- }
- if(GetPVarInt(playerid, "DisarmingBomb"))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are busy disarming the bomb.");
- return 1;
- }
- if(isnull(szParameters[1]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "USAGE: /bomb check [Vehicle ID]");
- return 1;
- }
- new
- iVehicleID = strval(szParameters[1]);
- if(!GetVehicleModel(iVehicleID))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid vehicle ID.");
- SendClientMessage(playerid, CB_COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles.");
- return 1;
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it.");
- return 1;
- }
- new
- Float: f_vPos[3];
- GetVehiclePos(iVehicleID, f_vPos[0], f_vPos[1], f_vPos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are not close enough to the vehicle.");
- return 1;
- }
- GameTextForPlayer(playerid, "~g~Checking for bombs... ~n~ ~y~Type ~r~/bomb check~y~ again to stop.", BOMB_CHECKTIME * 1100, 3);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_CHECKTIME * 1100, 0);
- SetPVarInt(playerid, "CheckingForBombs", SetTimerEx("CheckForBombs", BOMB_CHECKTIME * 1000, 0, "dd", playerid, iVehicleID));
- return 1;
- }
- if(!strcmp(szParameters[0], "disarm", true, 4))
- {
- new
- DisarmingBombTimerID = GetPVarInt(playerid, "DisarmingBomb");
- if(DisarmingBombTimerID)
- {
- KillTimer(DisarmingBombTimerID);
- DeletePVar(playerid, "DisarmingBomb");
- GameTextForPlayer(playerid, "~r~Stopped disarming the bomb", 2000, 3);
- return 1;
- }
- if(GetPVarInt(playerid, "CheckingForBombs"))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are busy checking for bombs.");
- return 1;
- }
- if(isnull(szParameters[1]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "USAGE: /bomb disarm [Vehicle ID]");
- SendClientMessage(playerid, CB_COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles.");
- return 1;
- }
- new
- iVehicleID = strval(szParameters[1]);
- if(!GetVehicleModel(iVehicleID))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid vehicle ID.");
- SendClientMessage(playerid, CB_COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles.");
- return 1;
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it.");
- return 1;
- }
- new
- Float: f_vPos[3];
- GetVehiclePos(iVehicleID, f_vPos[0], f_vPos[1], f_vPos[2]);
- if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2]))
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "You are not close enough to the vehicle.");
- return 1;
- }
- if(GetPVarInt(playerid, "CheckedCarForBombs") != iVehicleID)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You haven't checked this car for bombs yet, you need to see where it is first.");
- return 1;
- }
- if(GetPVarInt(playerid, "FoundBombInCar") != iVehicleID)
- {
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: You haven't found any bombs on this vehicle.");
- return 1;
- }
- GameTextForPlayer(playerid, "~g~Disarming bomb...~n~ ~y~Type ~r~/bomb disarm~y~ again to stop.", BOMB_DISARMTIME * 1000, 3);
- ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_DISARMTIME * 1100, 0);
- SetPVarInt(playerid, "DisarmingBomb", SetTimerEx("DisarmBomb", BOMB_DISARMTIME * 1000, 0, "dd", playerid, iVehicleID));
- return 1;
- }
- }
- SendClientMessage(playerid, CB_COLOR_GREY, "ERROR: Invalid parameter. For a full list of available parameters, type \"/bomb\".");
- return 1;
- }
- stock PlayVehicleBombSound(vehicleid, sound)
- {
- new
- Float: v_Pos[3];
- GetVehiclePos(vehicleid, v_Pos[0], v_Pos[1], v_Pos[2]);
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerInVehicle(i, vehicleid))
- {
- PlayerPlaySound(i, sound, v_Pos[0], v_Pos[1],v_Pos[2]);
- }
- else
- {
- if(IsPlayerInRangeOfPoint(i, 10.0, v_Pos[0], v_Pos[1], v_Pos[2]))
- {
- PlayerPlaySound(i, sound, v_Pos[0], v_Pos[1],v_Pos[2]);
- }
- }
- }
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new i; i < MAX_VEHICLES; i++)
- {
- if(g_Bomb_Vehicles[i][bv_i_BombOwner] == playerid)
- {
- g_Bomb_Vehicles[i][bv_i_BombOwner] = INVALID_PLAYER_ID;
- }
- }
- }
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- printf(" Loaded Car Bombs v1.0 by Lenny");
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement