24.01.2011, 06:21
Sorry for double posting, although
SetProgressBarValue(gGas[playerid], gas);
That dosent require a variable there? doesnt it?
You might as well put SetProgressBarValue(playerid, gas);
and with your gGas[vehicle] var, make it like
new gGas[MAX_VEHICLES];
then through that make a loop
Then after replace all gGas[vehicle] with gGas[a]
SetProgressBarValue(gGas[playerid], gas);
That dosent require a variable there? doesnt it?
You might as well put SetProgressBarValue(playerid, gas);
and with your gGas[vehicle] var, make it like
new gGas[MAX_VEHICLES];
then through that make a loop
pawn Код:
#define LoopVehicles(%1) for(new %1=0; %1<MAX_VEHICLES; %1++)
pawn Код:
public BenzinUpdate()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
LoopVehicles(a) {
new vehicle = GetPlayerVehicleID(i);
if(IsPlayerInAnyVehicle(i) == 1)
{
if(gGas[vehicle] >= 0 && gGas[vehicle] <= 3)
{
SetProgressBarValue(gas, 0.0);
ShowProgressBarForAll(gas);
TogglePlayerControllable(i, 0);
}
else if(gGas[vehicle] >= 0 && gGas[vehicle] <= 10)
{
SetProgressBarValue(gas, 10.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 10 && gGas[vehicle] <= 20)
{
SetProgressBarValue(gas, 20.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 20 && gGas[vehicle] <= 30)
{
SetProgressBarValue(gas, 30.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 30 && gGas[vehicle] <= 40)
{
SetProgressBarValue(gas, 40.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 40 && gGas[vehicle] <= 50)
{
SetProgressBarValue(gas, 50.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 50 && gGas[vehicle] <= 60)
{
SetProgressBarValue(gas, 60.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 60 && gGas[vehicle] <= 70)
{
SetProgressBarValue(gas, 70.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 70 && gGas[vehicle] <= 80)
{
SetProgressBarValue(gas, 80.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 80 && gGas[vehicle] <= 90)
{
SetProgressBarValue(gas, 90.0);
ShowProgressBarForAll(gas);
}
else if(gGas[vehicle] >= 90 && gGas[vehicle] <= 100)
{
SetProgressBarValue(gas, 100.0);
ShowProgressBarForAll(gas);
}
}
}
}
}
return 1;
}