Originally Posted by Andinho
Bom, aconselho procurar algum FS e estudar o mesmo, mais vou de dar um code :
no topo do GM abaixo das includes e defines coloque new Motor[MAX_VEICLES];
em OnGameModeInit... coloque ManualVehicleEngineAndLights();
em OnPlayerKeyStateChange coloque
if (newkeys==KEY_YES )
{
if(IsPlayerInAnyVehicle(playerid))
{
motorcarro(playerid);
}
}
agora no fim do GM ...
stock motorcarro(playerid)
{
if( GetPlayerState(playerid) == PLAYER_STATE_DRIVER )
{
new mot, lu, alar, por, cap, porma, ob;
new carro = GetPlayerVehicleID(playerid);
new Float:vidacarro;
GetVehicleHealth(carro, vidacarro);
GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
if(Motor[carro] == 0)
{
SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alar, por, cap, porma, ob);
Motor[carro] = 1;
SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
}
else
if(motor[carro] == 1)
{
SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alar, por, cap, porma, ob);
motor[carro] = 0;
SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Desligado!");
}
return 1;
}
return 1;
}
teste, e diga se fucionou .
@EDITE equeci da menssagem quando entrar no carro, porem, peзa para que alguem lhe explique, use a public OnPlayerStateChange estude as funзхes.
|