31.01.2010, 15:26
Hey,
only one Player get the minus of "Tank", why?
only one Player get the minus of "Tank", why?
pawn Код:
public 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 Float: verbrauch = GetPlayerVehicleVerbrauch(i);
new tank = speedcount[i]/130;
if(vehicle >= bike1 && vehicle <= bike3) return 1;
if(spawncar_gas[vehicle] > 1)
{
if(tank < 1)
{
spawncar_gas[vehicle] -= 0.1;
format(string, sizeof(string), "~r~Tank: %.1f/%d", spawncar_gas[vehicle], spawncar_maxgas[vehicle]);
TextDrawSetString(fd[i], string);
speedcount[i] = 0;
return 1;
}
if(tank >= 1 && tank <= 20)
{
spawncar_gas[vehicle] -= verbrauch;
format(string, sizeof(string), "~r~Tank: %.1f/%d", spawncar_gas[vehicle], spawncar_maxgas[vehicle]);
TextDrawSetString(fd[i], string);
speedcount[i] = 0;
return 1;
}
if(tank > 20 && tank <= 60)
{
spawncar_gas[vehicle] -= verbrauch*2;
format(string, sizeof(string), "~r~Tank: %.1f/%d", spawncar_gas[vehicle], spawncar_maxgas[vehicle]);
TextDrawSetString(fd[i], string);
speedcount[i] = 0;
return 1;
}
if(tank > 60)
{
spawncar_gas[vehicle] -= verbrauch*3;
format(string, sizeof(string), "~r~Tank: %.1f/%d", spawncar_gas[vehicle], spawncar_maxgas[vehicle]);
TextDrawSetString(fd[i], string);
speedcount[i] = 0;
return 1;
}
}
else
{
NoFuel[vehicle] = 1;
RemovePlayerFromVehicle(i);
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
return 1;
}
}
}
}
return 1;
}