vehicle bomb not detonating
#5

pawn Код:
CMD:pcb(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] != 4 && PlayerInfo[playerid][pLeader] != 4) return SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the International Contract Agency !");
    if(PlayerInfo[playerid][pC4]) return SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time !");
    if(!PlayerInfo[playerid][pBombs]) return SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
    new closestcar = GetClosestCar(playerid, GetPlayerVehicleID(playerid));
    if(!IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0) || closestcar == INVALID_VEHICLE_ID) return SendClientMessage(playerid, COLOR_GRAD2, "You're not close enough to any vehicle!");
    if(VehicleBomb{closestcar}) return SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
    VehicleBomb{closestcar} = 1;
    PlacedVehicleBomb[playerid] = closestcar;
    ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
    SendClientMessage(playerid, COLOR_GREEN, "You have placed C4 on the vehicle engine, /pickupbomb to remove it.");
    PlayerInfo[playerid][pC4] = 1;
    PlayerInfo[playerid][pBombs]--;
    PlayerInfo[playerid][pC4Used] = 2;
    return 1;
}

CMD:engine(playerid, params[])
{
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1, "You must be the driver of a vehicle to use this command.");
    new vehicleid = GetPlayerVehicleID(playerid);
    switch(GetVehicleModel(vehicleid))
    {
        case 481, 509, 510: return SendClientMessageEx(playerid, COLOR_WHITE, "This command can't be used in this vehicle.");
        default:
        {
            if(VehicleBomb{vehicleid}) //Vehicle has a bomb attached
            {
                new Float:x, Float:y, Float:z;
                GetVehiclePos(vehicleid, x, y, z);
                CreateExplosion(x, y, z, 6, 8.0);
                SendClientMessage(playerid, -1, "Your car had a bomb attached to it!");
                VehicleBomb{vehicleid} = 0;
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(!IsPlayerConnected(i)) continue;
                    if(PlacedVehicleBomb[i] != vehicleid) continue;
                    PlacedVehicleBomb[i] = INVALID_VEHICLE_ID;
                    PlayerInfo[i][pC4] = 0;
                    SendClientMessage(i, -1, "The bomb you planted has been triggered!");
                    break;
                }
            }
            new temp[7];
            GetVehicleParamsEx(vehicleid, temp[0], temp[1], temp[2], temp[3], temp[4], temp[5], temp[6]);
            if(temp[0] == VEHICLE_PARAMS_ON) SetVehicleEngine(vehicleid, playerid);
            else if((temp[0] == VEHICLE_PARAMS_OFF || temp[0] == VEHICLE_PARAMS_UNSET))
            {
                SetTimerEx("SetVehicleEngine", 2000, 0, "dd",  vehicleid, playerid);
                if(PlayerInfo[playerid][pMask]) ProxDetector(30.0, playerid, "Stranger has successfully started their Vehicle engine", COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                else
                {
                    new string[75];
                    format(string, sizeof(string), "* %s has successfully started their Vehicle engine", GetPlayerNameEx(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                }
            }
        }
    }
    return 1;
}
These two should work.
Reply


Messages In This Thread
vehicle bomb not detonating - by Lukka_Vercetti - 30.07.2014, 22:34
Re: vehicle bomb not detonating - by Threshold - 31.07.2014, 03:53
Re: vehicle bomb not detonating - by Lukka_Vercetti - 31.07.2014, 06:44
Respuesta: Re: vehicle bomb not detonating - by Zume - 31.07.2014, 07:23
Re: vehicle bomb not detonating - by Threshold - 31.07.2014, 08:22
Re: vehicle bomb not detonating - by Lukka_Vercetti - 31.07.2014, 22:49

Forum Jump:


Users browsing this thread: 1 Guest(s)