Hey Com,
Wenn der Motor eines Fahrzeug an ist soll der Tank weiter abgezogen werden?
Hier die Function:
Function CheckGas()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
new Model = GetVehicleModel(GetPlayerVehicleID(i));
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
if(gGas[i] == 1) {
format(string, sizeof(string), "~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Benzin:~w~ %dLiter",Gas[vehicle]);
GameTextForPlayer(i,string,15500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || Model == 462 || Model == 481)
{
Gas[vehicle]++;
}
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(i);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
{
if(engine == VEHICLE_PARAMS_ON)
{
Gas[vehicle]--;
}
}
}
else
{
new lights,alarm,doors,bonnet,boot,objective;
NoFuel[i] = 1;
SetVehicleParamsEx(vehicle,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(i,WHITE,"Dein Benzin ist leer, rufe das Oamt oder ein Mechaniker!");
}
}
}
}
return 1;
}
Mfg