When enter in vehicle say me: you turned off engine, but car is turned off. -.-"
Код:
new engine, lights, alarm, doors, bonnet, boot, objective; // Required variables.
for(new i; i < MAX_VEHICLES; i++) // This is the loop if i is smaller then MAX VEHICLES it will continue.
{
if (GetVehicleModel(i) != 0) // Check if the vehicle exists
{
GetVehicleParamsEx(i, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(i, 0, 0, alarm, doors, bonnet, boot, objective); // Keep all parameters, but turn engine and lights off
}
}
Код:
if(PRESSED(KEY_SUBMISSION))//If the player pressed KEY_SUBMISSION (2)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)//Checks if the player is the driver
{
new vehicle = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;//The vehicle params
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);//Getting the vehicle params
if(engine == 0)//If the engine is off
{
SetVehicleParamsEx(vehicle,1,1,alarm,doors,bonnet,boot,objective);//We turn on the engine and lights
SendClientMessage(playerid,-1,"You started the engine!");
}
else//Else is the engine is on
{
SetVehicleParamsEx(vehicle,0,0,alarm,doors,bonnet,boot,objective);//We turn off the engine and lights
SendClientMessage(playerid,-1,"You stopped the engine!");//Sends a message to the player telling him he stopped the engine.
}
return 1;
}
}