Problem with fuel timer.
#1

So timer should check, if fuel is 0, it turn engine off. But it do it also when fuel is not 0.

pawn Код:
if(Engine[v] == 1)
   {
   if(vInfo[v][vBensiin] > 0)
   {

    vInfo[v][vBensiin] -=1;
    }
    else if(vInfo[v][vBensiin] == 0)
    {
    Engine[v] = 0;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
    SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, 0);
       
    }
}
Reply
#2

[v] do you use loop?
post the full code.
Reply
#3

pawn Код:
public Bena()
{
   
   new autosidkokku = vehicles_created + fvehicles_created + tvehicles_created;
    for(new v = 1; v < autosidkokku; v++)
    {
    if(v != 0)
    {

   if(Engine[v] == 1)
   {
   if(vInfo[v][vBensiin] > 0)
   {

    vInfo[v][vBensiin] -=1;
    }
    else if(vInfo[v][vBensiin] == 0)
    {
    Engine[v] = 0;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
    SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, 0);
       
    }
    if(fInfo[v][Bensiin] > 0)
    {
    fInfo[v][Bensiin] -=1;
    }
    else if(fInfo[v][Bensiin] == 0)
    {
    Engine[v] = 0;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
    SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, 0);
    }
   
if(taInfo[v][Bensiin] > 0)
    {
    taInfo[v][Bensiin] -=1;
    }
     else if(taInfo[v][Bensiin] == 0)
    {
    Engine[v] = 0;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
    SetVehicleParamsEx(v, 0, lights, alarm, doors, bonnet, boot, 0);
    }
}

}
}
return 1;
}
Reply
#4

Try this:

Quote:

public Bena()
{

new autosidkokku = vehicles_created + fvehicles_created + tvehicles_created;
for(new v = 0; v < autosidkokku; v++)
{
if(Engine[v] == 1)
{
if(vInfo[v][vBensiin] > 0)
{
vInfo[v][vBensiin] -= 1;
}
else if(vInfo[v][vBensiin] <= 0)
{
Engine[v] = 0;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(v, engine, lights, alarm, doors, bonnet, boot, objective);//This bit is checking the current status of the vehicles.
SetVehicleParamsEx(v,VEHICLE_PARAMS_OFF,lights,ala rm,doors,bonnet,boot,objective);
}
}
}
return 1;
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)