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;
GetVehiclePos(vehicle, boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
if(pMask[playerid] == 1)
{
format(string, sizeof(string), "* Stranger failed to start the engine and car bomb exploded");
}
else
{
format(string, sizeof(string), "* %s failed to start the engine and car bomb exploded", GetPlayerNameEx(playerid));
}
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_YELLOW, "The vehicle exploded because of the car bomb planted by an hitman!");
return engine;
}
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);
SendClientMessage(playerid, -1, "Vehicle engine started successfully! Type (/car engine) to stop it");
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);
SendClientMessage(playerid, -1, "Vehicle engine stopped. Type (/car engine) to start");
return 1;
}
}
return engine;
}
return 1;
}
else if(!strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
|
try this
pawn Code:
|
if(isnull(params))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /car [name]");
SendClientMessage(playerid, COLOR_GREY, "Available names: Engine, Lights, Trunk, Hood");
return 1;
}
else if(strcmp(params, "lights", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
SetVehicleLights(vehicleid, playerid);
}
else if(strcmp(params, "trunk", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
}
SetVehicleTrunk(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0))
{
if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510)
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
}
SetVehicleTrunk(closestcar, playerid);
}
}
}
else if(strcmp(params, "hood", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510 || IsAPlane(vehicleid) || IsABike(vehicleid))
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
}
SetVehicleHood(vehicleid, playerid);
}
else if(!IsPlayerInAnyVehicle(playerid))
{
new closestcar = GetClosestCar(playerid);
if(IsPlayerInRangeOfVehicle(playerid, closestcar, 5.0))
{
if(GetVehicleModel(closestcar) == 481 || GetVehicleModel(closestcar) == 509 || GetVehicleModel(closestcar) == 510 || IsAPlane(closestcar) || IsABike(closestcar))
{
return SendClientMessage(playerid,COLOR_WHITE,"This command can't be used on this vehicle.");
}
SetVehicleHood(closestcar, playerid);
}
}
}
else if(!strcmp(params, "engine", true) == 0 && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
else if(!strcmp(params, "engine", true) && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
|
oh do like this
pawn Code:
|
|
are u using u have nativechecker and sscanf plugins?
if not then use them and also are other commands in the same FS working? and on more thing why is this line there "return engine;" caz if engine is off then it will return a value 0 which will show command doesnt exits |
if(strcmp(params, "engine", true,10) == 0)
{
/*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;
GetVehiclePos(vehicle, boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
if(pMask[playerid] == 1)
{
format(string, sizeof(string), "* Stranger failed to start the engine and car bomb exploded");
}
else
{
format(string, sizeof(string), "* %s failed to start the engine and car bomb exploded", GetPlayerNameEx(playerid));
}
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_YELLOW, "The vehicle exploded because of the car bomb planted by an hitman!");
return engine;
}
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);
SendClientMessage(playerid, -1, "Vehicle engine started successfully! Type (/car engine) to stop it");
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);
SendClientMessage(playerid, -1, "Vehicle engine stopped. Type (/car engine) to start");
return 1;
}
}
return engine;
}
return 1;
}
|
remove the line "return engine;"
whats the point of keeping this line just remove this line which i told |
[14:22:56] * Kahili turns the engine of their vehicle engine on.
[14:22:56] That {0000FF}command {FFFFFF}does not exist. Use /help to see the commands.
else if(!strcmp(params, "engine", true) && 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)
{
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);
// SendClientMessage(playerid, -1, "Vehicle engine started successfully! Type (/car engine) to stop it");
[B][COLOR="Red"] if(VehicleBomb[vehicle] == 1)
{
new Float:boomx, Float:boomy, Float:boomz;
GetVehiclePos(vehicle, boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
if(pMask[playerid] == 1)
{
format(string, sizeof(string), "* Stranger failed to start the engine and car bomb exploded");
}
else
{
format(string, sizeof(string), "* %s failed to start the engine and car bomb exploded", GetPlayerNameEx(playerid));
}
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_YELLOW, "The vehicle exploded because of the car bomb planted by an hitman!");[/COLOR][/B]
}
else return SendClientMessage(playerid, -1, "Vehicle engine started successfully! Type (/car engine) to stop it");
}
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);
SendClientMessage(playerid, -1, "Vehicle engine stopped. Type (/car engine) to start");
return 1;
}
}
return SendClientMessage(playerid, COLOR_GRAD1, "This command can only use in vehicle!");
02/05/2014 15:31:42] [debug] Run time error 4: "Array index out of bounds" [02/05/2014 15:31:42] [debug] Accessing element at index 632 past array upper bound 499 [02/05/2014 15:31:42] [debug] AMX backtrace: [02/05/2014 15:31:42] [debug] #0 00111788 in public cmd_car (0x00000000, 0x014e0e38) from PHRP_1.2.amx [02/05/2014 15:31:42] [debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe [02/05/2014 15:31:42] [debug] #2 00003dcc in public OnPlayerCommandText (0x00000000, 0x014e0e08) from PHRP_1.2.amx
if(Engine[vehicle] == 0)
{
if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(VehicleBomb[vehicle] == 1)
{
new Float:boomx, Float:boomy, Float:boomz;
GetVehiclePos(vehicle, boomx, boomy, boomz);
CreateExplosion(boomx, boomy , boomz, 7, 1);
if(pMask[playerid] == 1)
{
format(string, sizeof(string), "* Stranger failed to start the engine and car bomb exploded");
}
else
{
format(string, sizeof(string), "* %s failed to start the engine and car bomb exploded", GetPlayerNameEx(playerid));
}
ProxDetector(20.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SendClientMessage(playerid, COLOR_YELLOW, "The vehicle exploded because of the car bomb planted by an hitman!");
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);
SendClientMessage(playerid, -1, "Vehicle engine started successfully! Type (/car engine) to stop it");
}
}
new VehicleBomb[MAX_PLAYERS];
new VehicleBomb[MAX_VEHICLES];
|
How did you define the VehicleBomb?
The problem might be that you have made it pawn Code:
pawn Code:
|
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.");
SendClientMessage(playerid, COLOR_REALRED, "You have placed C4 on the vehicle, Wait till someone start the vehicle engine to explode the bomb");
PlayerInfo[playerid][pC4] = 1;
PlayerInfo[playerid][pBombs]--;
PlayerInfo[playerid][pC4Used] = 2;
new VehicleBomb //and something after it
|
well you should have VehicleBomb defined,search for it and paste it,it would be like
pawn Code:
|

new VehicleBomb[MAX_VEHICLES char] = 0;