i created script like this
and when i plant 2 bomb, and then defuse it, my bomb number 1 got defused too
defuse cmd
can anyone help me fix this? :(
Code:
CMD:plant(playerid, params[])
{
if(PlayerInfo[playerid][pBombAccess] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "you need access if you want to use c4, go to electronic shop near pizza");
{
if(!IsPlayerInAnyVehicle(playerid))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
bom = CreateObject(1252, X, Y, Z-1, 0.0, 0.0, 90.0);
bactv[bom] = 1;
SetObjectRot(bom, 901, 270, 270);
SetTimerEx("SOUND1", 1000, false, "i", playerid);
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "you need to be on foot to plant bomb!");
}
}
return 1;
}
defuse cmd
Code:
CMD:def(playerid, params[])
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(bom,X,Y,Z);
if (!IsPlayerInRangeOfPoint(playerid, 2.0, X, Y, Z)) return SendClientMessage(playerid, 0xFFFFFFFF, "there is no bomb on range, you maybe need to get closer to the bomg or there is no bomb near you!");
{
if(bactv[bom] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "The Bomb is not Active!");
{
if(!IsPlayerInAnyVehicle(playerid))
{
ShowPlayerDialog(playerid, 7355, DIALOG_STYLE_INPUT, "Bomb Defuse!", "Enter Password To Defuse Bomb!!!!", "Defuse!", "RIP");
TogglePlayerControllable(playerid,0);
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "you need to be on foot to defuse bomb!");
}
}
}
return 1;
}