Errors. -
I just got a good function from a filterscript and I want to put it on my GM but I get Errors:
pawn Код:
if(IsKeyJustDown(KEY_YES, newkeys, oldkeys))
{
new vehicleid,panels,doors,lights,tires;
vehicleid = GetPlayerVehicleID(playerid);
if(!Flasher[vehicleid]) {
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
return SendClientMessageEx(playerid, COLOR_GREY, "* You are not the driver!");
}
if (!GetVehicleModel(vehicleid)) return SendClientMessageEx(playerid, OLOR_GREY, "* You are not in a vehicle!");
if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid]))
{
SendClientMessageEx(playerid, OLOR_GREY, "You switched off the lights."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
if(LightPwr[vehicleid] == 1)
UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
else
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
Flasher[vehicleid] = 0;
}
switch (GetVehicleModel(vehicleid))
{
case 596:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 597:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 598:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 599:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 541://bullet
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 426://premier
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 427://enforcer
{
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 416://Ambulance
{
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 407://FireTruck
{
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 560://sultan
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
case 490://FBI
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
default:
{
return SendClientMessageEx(playerid, OLOR_GREY, "You are not in a CODE 2 compatible police vehicle!");
}
}
return SendClientMessageEx(playerid, OLOR_GREY, "Lights on, you are now in a CODE 2 run!");
} else {
if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid])) {
SendClientMessageEx(playerid, OLOR_GREY, "You switched off the lights."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);
}
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
if(LightPwr[vehicleid] == 1)
UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
else
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
Flasher[vehicleid] = 0;
}
Re: Errors. -
Re: Errors. -
Re: Errors. -
a closing brace looks like this }.
For each opening brace, a closing brace is required. Look where one is missing.
Re: Errors. -
Try indenting the brackets properly, missing/dislocated brackets often create these type of errors.
Messy code is hard to read to find them, so...
Then post what you have, if you don't see the error. I can't see it in what you have now.
Re: Errors. -