08.06.2011, 18:23
Hello guys. I made my engine system, but the only problem is:
If i use the cmd to turn engine off, it works, if i use the cmd to turn it on, it works but when i enter a car, the engine is allways on....
My code is:
I want it to turn the engine off when someone enter a car.
If i use the cmd to turn engine off, it works, if i use the cmd to turn it on, it works but when i enter a car, the engine is allways on....
My code is:
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFF00CC, "Use /ste to start the vehicle engine.");
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFF00CC, "You turned the engine off.");
return 1;
}
COMMAND:ste(playerid, param[])
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFF00CC, "Engine Started. Use /spe to turn the vehicle engine off again.");
return 1;
}
COMMAND:spe(playerid, param[])
{
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(playerid, 0xFF00CC, "Engine Stoped. Use /ste to turn the vehicle engine on again.");
return 1;
}