27.12.2016, 18:48
Eu nгo manjo muito disso, entгo peguei um sistema que jб funciona, mas, ele sу funciona quando o player estб dentro do veнculo
O que precisa ser feito para continuar o consumo de combustнvel mesmo quando o player estiver fora do veнculo?
PHP код:
CheckGas()
{
foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new engine, lights, alarm, doors, bonnet, boot, objective;
new vehicle = GetPlayerVehicleID(i);
new VehicleModel = GetVehicleModel(vehicle);
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine == 0)
{
break;
}
if(VehicleModel == 487 || VehicleModel == 520 || VehicleModel == 462 ||
VehicleModel == 497 || VehicleModel == 425 || VehicleModel == 592 ||
VehicleModel == 519 || VehicleModel == 593 || VehicleModel == 452 ||
VehicleModel == 510)
{
continue;
}
if(IsARespCar(vehicle))
{
continue;
}
new Float:health = GetPlayerVehicleHealth(i);
if(health < 20)continue;
if(Gas[vehicle] >= 1 && vehicle < TOTAL_CARROS)
{
if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}
if(Gas[vehicle] >= 1 && Gas[vehicle] < 4)
{
new rdon = random(10);
if(rdon >= 0 && rdon <= 7)
{
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
foreach(Player, pp)
{
if(GetPlayerVehicleID(pp) == vehicle)
{
SendClientMessage(pp, COLOR_GRAD1, "Aviso: Pouco combustivel no veiculo, o motor desligou. De a partida novamente!");
}
}
}
}
Gas[vehicle]--;
UpdateGas(vehicle);
}
else if(CarConce[vehicle] >= 0)
{
if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}
if(Gas[vehicle] >= 1 && Gas[vehicle] < 4)
{
new rdon = random(10);
if(rdon >= 0 && rdon <= 7)
{
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
foreach(Player, pp)
{
if(GetPlayerVehicleID(pp) == vehicle)
{
SendClientMessage(pp, COLOR_GRAD1, "Aviso: Pouco combustivel no veiculo, o motor desligou. De a partida novamente!");
}
}
}
}
Gas[vehicle]--;
UpdateGas(vehicle);
}
else
{
if(vehicle >= TOTAL_CARROS)continue;
NoFuel[i] = 1;
PlayerPlaySound(i, 1159, 0.0, 0.0, 0.0);
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
GameTextForPlayer(i,"~r~Sem combustivel~n~~y~Chame um mecanico para ajudar",1500,3);
UpdateGas(vehicle);
}
}
}