Vehicle Explosions Doesnt Work
#1

Код:
	            if(VehicleBomb[vehicle] == 1)
	            {
            		new Float:boomx, Float:boomy, Float:boomz;
					GetPlayerPos(playerid,boomx, boomy, boomz);
					CreateExplosion(boomx, boomy , boomz, 7, 1);
					VehicleBomb[vehicle] = 0;
	            }
Код:
CMD:pcb(playerid, params[])
{
	if(PlayerInfo[playerid][pFaction] == 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;
}
Код:
	else if(strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
	    /*if (vdisabled[GetPlayerVehicleID(playerid)])
		{
        SendClientMessage(playerid, COLOR_RED, "The car's engine is too damaged to start!- Call a mechanic! /service mechanic");
        return 1;
    	}*/
	    new vehicle = GetPlayerVehicleID(playerid);
	    new string[126];
      	new engine, lights, alarm, doors, bonnet, boot, objective;
	    GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);

	    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
	        if(Engine[vehicle] == 0)
	        {
	            if(VehicleBomb[vehicle] == 1)
	            {
            		new Float:boomx, Float:boomy, Float:boomz;
					GetPlayerPos(playerid,boomx, boomy, boomz);
					CreateExplosion(boomx, boomy , boomz, 7, 1);
					VehicleBomb[vehicle] = 0;
	            }
		     	if(GetChased[playerid] < 999 && VehicleBomb[vehicle] == 1)
				{
					if(PlayerInfo[playerid][pHeadValue] >= 1)
					{
						if(PlayerInfo[GetChased[playerid]][pFaction] == 4 || PlayerInfo[GetChased[playerid]][pLeader] == 4)
						{
							new Float:boomx, Float:boomy, Float:boomz;
							GetPlayerPos(playerid,boomx, boomy, boomz);
							CreateExplosion(boomx, boomy , boomz, 7, 1);
							VehicleBomb[vehicle] = 0;
							PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
							new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
							GivePlayerCash(GetChased[playerid], takemoney);
							GivePlayerCash(playerid, -takemoney);
							format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),PlayerInfo[playerid][pHeadValue] / 4 * 2);
							SendFamilyMessage(8, COLOR_YELLOW, string);
							format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
							ResetPlayerWeaponsEx(playerid);
							// SpawnPlayer(playerid);
							SendClientMessageEx(playerid, COLOR_YELLOW, string);
							PlayerInfo[playerid][pHeadValue] = 0;
							PlayerInfo[GetChased[playerid]][pCHits] += 1;
							SetPlayerHealth(playerid, 0.0);
							// KillEMSQueue(playerid);
							GoChase[GetChased[playerid]] = 999;
							PlayerInfo[GetChased[playerid]][pC4Used] = 0;
							PlayerInfo[GetChased[playerid]][pC4] = 0;
							GotHit[playerid] = 0;
							GetChased[playerid] = 999;
							new str[128];
							new string2[128];
							format(string2, sizeof(string2), "* %s turns the engine of their vehicle engine on.", GetPlayerNameEx(playerid));
							format(str, sizeof(str), "* %s Failed to start the vehicle because of the car bomb and engine explodes.", GetPlayerNameEx(playerid));
				    		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				    		SendClientMessage(playerid, COLOR_YELLOW, "An hitman just killed you with the car bomb!");
							return 1;
						}
					}
				}
				else
				{
					Engine[vehicle] = 1;
				    SetVehicleParamsEx(vehicle,1,lights,alarm,doors,bonnet,boot,objective);
				    format(string, sizeof(string), "* %s turns the engine of their vehicle engine on.", GetPlayerNameEx(playerid));
				    ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	      			return 1;
				}
	        }
	        else
	        {
	            Engine[vehicle] = 0;
	            SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
	            format(string, sizeof(string), "* %s turns the vehicles engine off.", GetPlayerNameEx(playerid));
	            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            return 1;
	        }
	    }
	    return engine;
	}
	return 1;
}
I want instead the vehicle will only explode if you getting chased i want it to explode too when VehicleBomb[vehicle[ is 1. How ? Is it possible? Thanks!

Thank you for helping! Im so glad at your helps!
Reply
#2

To explode only when VehicleBomb is 1, use a condition:

pawn Код:
if(VehicleBomb[vehicle] == 1)
{
    // do something
}
And define to us, what is a chased vehicle?
Reply
#3

Quote:
Originally Posted by arakuta
Посмотреть сообщение
To explode only when VehicleBomb is 1, use a condition:

pawn Код:
if(VehicleBomb[vehicle] == 1)
{
    // do something
}
And define to us, what is a chased vehicle?
Yes, you are correct, but it doesnt expldoe
Код:
{
	    /*if (vdisabled[GetPlayerVehicleID(playerid)])
		{
        SendClientMessage(playerid, COLOR_RED, "The car's engine is too damaged to start!- Call a mechanic! /service mechanic");
        return 1;
    	}*/
	    new vehicle = GetPlayerVehicleID(playerid);
	    new string[126];
      	new engine, lights, alarm, doors, bonnet, boot, objective;
	    GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);

	    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	    {
	        if(Engine[vehicle] == 0)
	        {
	            if(VehicleBomb[vehicle] == 1)
	            {
            		new Float:boomx, Float:boomy, Float:boomz;
					GetPlayerPos(playerid,boomx, boomy, boomz);
					CreateExplosion(boomx, boomy , boomz, 7, 1);
					VehicleBomb[vehicle] = 0;
	            }
		     	if(GetChased[playerid] < 999 && VehicleBomb[vehicle] == 1)
				{
					if(PlayerInfo[playerid][pHeadValue] >= 1)
					{
						if(PlayerInfo[GetChased[playerid]][pFaction] == 4 || PlayerInfo[GetChased[playerid]][pLeader] == 4)
						{
							new Float:boomx, Float:boomy, Float:boomz;
							GetPlayerPos(playerid,boomx, boomy, boomz);
							CreateExplosion(boomx, boomy , boomz, 7, 1);
							VehicleBomb[vehicle] = 0;
							PlacedVehicleBomb[GetChased[playerid]] = INVALID_VEHICLE_ID;
							new takemoney = PlayerInfo[playerid][pHeadValue] / 4 * 2;
							GivePlayerCash(GetChased[playerid], takemoney);
							GivePlayerCash(playerid, -takemoney);
							format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d.",GetPlayerNameEx(GetChased[playerid]),GetPlayerNameEx(playerid),PlayerInfo[playerid][pHeadValue] / 4 * 2);
							SendFamilyMessage(8, COLOR_YELLOW, string);
							format(string,sizeof(string),"You have been critically injured by a hitman and lost $%d!",takemoney);
							ResetPlayerWeaponsEx(playerid);
							// SpawnPlayer(playerid);
							SendClientMessageEx(playerid, COLOR_YELLOW, string);
							PlayerInfo[playerid][pHeadValue] = 0;
							PlayerInfo[GetChased[playerid]][pCHits] += 1;
							SetPlayerHealth(playerid, 0.0);
							// KillEMSQueue(playerid);
							GoChase[GetChased[playerid]] = 999;
							PlayerInfo[GetChased[playerid]][pC4Used] = 0;
							PlayerInfo[GetChased[playerid]][pC4] = 0;
							GotHit[playerid] = 0;
							GetChased[playerid] = 999;
							new str[128];
							new string2[128];
							format(string2, sizeof(string2), "* %s turns the engine of their vehicle engine on.", GetPlayerNameEx(playerid));
							format(str, sizeof(str), "* %s Failed to start the vehicle because of the car bomb and engine explodes.", GetPlayerNameEx(playerid));
				    		ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
				    		SendClientMessage(playerid, COLOR_YELLOW, "An hitman just killed you with the car bomb!");
							return 1;
						}
					}
				}
				else
				{
					Engine[vehicle] = 1;
				    SetVehicleParamsEx(vehicle,1,lights,alarm,doors,bonnet,boot,objective);
				    format(string, sizeof(string), "* %s turns the engine of their vehicle engine on.", GetPlayerNameEx(playerid));
				    ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	      			return 1;
				}
	        }
	        else
	        {
	            Engine[vehicle] = 0;
	            SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
	            format(string, sizeof(string), "* %s turns the vehicles engine off.", GetPlayerNameEx(playerid));
	            ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	            return 1;
	        }
	    }
	    return engine;
	}
	return 1;
}
ChasedVehicle is when you getting chased by hitman if you /givemehit, because there is a /contract cmd

Код:
CMD:givemehit(playerid, params[])
{
	if(PlayerInfo[playerid][pFaction] == 4 || PlayerInfo[playerid][pLeader] == 4)
	{
		new string[128], targetid;
		if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givemehit [targetid]");

		if(IsPlayerConnected(targetid))
		{
			if(GoChase[playerid] < 999)
			{
				SendClientMessage(playerid, COLOR_GREY, "   You're already busy with another contract!");
				return 1;
			}
			if(GotHit[targetid] == 1)
			{
				SendClientMessage(playerid, COLOR_GREY, "   Another hitman has already assigned this target!");
				return 1;
			}
			if(PlayerInfo[targetid][pHeadValue] == 0)
			{
				SendClientMessage(playerid, COLOR_GREY, "   That target doesn't have a contract on them!");
				return 1;
			}
			format(string, sizeof(string), "* You have offered yourself a contract to kill %s. (type /accept contract)", GetPlayerNameEx(targetid));
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			HitOffer[playerid] = playerid;
			HitToGet[playerid] = targetid;
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "   The contracted person is offline, use /contracts!");
			return 1;
		}
	}
	return 1;
}
Reply
#4

Reading your question again, you want to explode a vehicle if it's chased or bombed? right?

You can use OR operator in a condition, like this

pawn Код:
if(VehicleBomb[vehicleid] == 1 || GoChase[playerid] < 999)
{
    // do something
}
But if your problem isn't with the conditions, make sure the variable values are all right.
Reply
#5

Quote:
Originally Posted by arakuta
Посмотреть сообщение
Reading your question again, you want to explode a vehicle if it's chased or bombed? right?

You can use OR operator in a condition, like this

pawn Код:
if(VehicleBomb[vehicleid] == 1 || GoChase[playerid] < 999)
{
    // do something
}
But if your problem isn't with the conditions, make sure the variable values are all right.
Yes, if its chased or bombed.

All variable values are right, i think

And i put this

Код:
if(VehicleBomb[vehicle] == 1)
	            {
            		new Float:boomx, Float:boomy, Float:boomz;
					GetPlayerPos(playerid,boomx, boomy, boomz);
					CreateExplosion(boomx, boomy , boomz, 7, 1);
					VehicleBomb[vehicle] = 0;
	            }
It doesnt work at all
Reply
#6

UPPPPPPPP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)