19.10.2015, 14:38
hello
i have this script , its work , i press 2 engine start , BUT after 10 seconds the car is turned off automatically?
how to fix it pleasee.
PHP код:
#include <a_samp>
#include <zcmd>
public OnGameModeInit()
{
ManualVehicleEngineAndLights(); // Initalization engine systems
return true;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new vehicleid = GetPlayerVehicleID(playerid);
if (vehicleid) {
if ((newkeys & KEY_SUBMISSION) && GetPlayerVehicleSeat(playerid) == 0) {
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if (!engine) engine = 1;
else engine = 0;
SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
return true;
}
}
return true;
}
CMD:engine(playerid,params[])
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new vehicleid = GetPlayerVehicleID(playerid);
if(IsPlayerInAnyVehicle(playerid))
{
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, !engine, lights, alarm, doors, bonnet, boot, objective);
SendClientMessage(playerid, 0xFFFFFFFF, "Your vehicle's engine is now turned [ON].");
}
else
{
//Send a message telling he is not in a vehicle to manipulate an engine
}
return 1;
}
how to fix it pleasee.