16.12.2011, 14:48
Now it works, but when I leave and enter the car the engine starts again. I think adding other variable storing informations about breaking like that:
if car broken set Broken[vehicleid] to true
if Broken[vehicleid]==false start the engine
and I got something like that:
But it shows
if car broken set Broken[vehicleid] to true
if Broken[vehicleid]==false start the engine
and I got something like that:
pawn Код:
new bool:Broken[9000];
(...)
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
// Setup local variables
new engine, lights, alarm, doors, bonnet, boot, objective;
(...)
if (Broken[vehicleid]==false){
// Start the engine and turn on the lights
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, 1, alarm, doors, bonnet, boot, objective);
}
(...)
return 1;
}
(...)
public CarCheckTimer(playerid)
{
for(new i=0; i<MAX_VEHICLES; i++) {
new Float:vhealth, vehicleid, Float:x = 0.0, Float:y = 0.0, Float:z = 0.0;
vehicleid = GetPlayerVehicleID(playerid);
(...)
Broken[vehicleid] = true;
SendClientMessage(playerid, -1, "Your car is broken.");
return 1;
}
}
return 1;
}
Код:
error 033: array must be indexed (variable "Broken")