Help on PlantCarBomb
#1

Hey guys, i need help on my PlantCarBomb for Hitmans, When you /plantcarbomb it then the car will start, the bomb will not explode. Here's my code.

Код:
CMD:pcb(playerid, params[])
{
	if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
	{
		if(PlayerInfo[playerid][pC4] == 0)
		{
			if(PlayerInfo[playerid][pBombs] != 0)
			{
				new carid = GetPlayerVehicleID(playerid);
				new closestcar = GetClosestCar(playerid, carid);
				if(IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0))
				{
					if(VehicleBomb{closestcar} == 1)
					{
						SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
						return 1;
					}
					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;
				}
				else
				{
					SendClientMessage(playerid, COLOR_GRAD2, "You're not close enough to any vehicle!");
					return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time ! ");
			return 1;
		}
	}
	else
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the Hitman Agency ! ");
	}
	return 1;
}
Reply
#2

I cleaned this up, but you didn't post the code where the bomb explosion is initiated.

pawn Код:
CMD:pcb(playerid, params[])
{
    if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
    {
        if(PlayerInfo[playerid][pC4] == 0)
        {
            if(PlayerInfo[playerid][pBombs] != 0)
            {
                new carid = GetPlayerVehicleID(playerid);
                new closestcar = GetClosestCar(playerid, carid);
                if(IsPlayerInRangeOfVehicle(playerid, closestcar, 4.0))
                {
                    if(VehicleBomb[closestcar] == 1) SendClientMessage(playerid, COLOR_GRAD2, "There is already a C4 on the vehicle engine!");
                    else
                    {
                        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;
                    }
                }
                else SendClientMessage(playerid, COLOR_GRAD2, "You're not close enough to any vehicle!");
            }
            else SendClientMessage(playerid, COLOR_GRAD2, "You do not have C4!");
        }
        else SendClientMessage(playerid, COLOR_GRAD2, " You can only deploy 1 C4 at a time ! ");
    }
    else SendClientMessage(playerid, COLOR_GRAD2, "You're not a member of the Hitman Agency ! ");
    return 1;
}
Reply
#3

LOL, i try it, the compilation is good, then i try it on GAME it says unknown command.
Reply
#4

That would almost certainly be an array out of bounds try running the crash detector then show me the error.
Reply
#5

If you want help with a system you need to include all necessary parts pertaining to that system.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)