SA-MP Forums Archive
One Player Bug. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: One Player Bug. (/showthread.php?tid=124717)



One Player Bug. - Justsmile - 31.01.2010

Hey,

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;
}



Re: One Player Bug. - ray187 - 31.01.2010

Jaja die Deutschen...

What do you mean with only one player gets the minus?


Re: One Player Bug. - Justsmile - 31.01.2010

Ja, nur die Person die als erstes / als einzigstes im Auto ist wird abgezogen und angezeigt. Bei anderen wiirds abgeozegen aber nicht angezeigt

Only the person who gets first in / only one in get lower fuel and will be correctly displayed, But at the others not correctly displaid


Re: One Player Bug. - ray187 - 31.01.2010

Jo gilt nur fьr die Personen die Fahrer sind. Siehe if-statement "if(GetPlayerState(i) == PLAYER_STATE_DRIVER)"

Yeah applies only for the driver of the vehicle.


Re: One Player Bug. - Justsmile - 31.01.2010

ich weiЯ aber es sind alle im Vehicle, der Textdraw wird aber nur fьr eine Person aktualisiert. jeder player hat einen eiogenen Textdraw.

know but they are all in the vehicle, the textdraw it's not updated for one person. each player has a eiogenen textdraw.


Re: One Player Bug. - ray187 - 31.01.2010

Willst du, dass der Textdraw fьr alle im Auto angezeigt wird oder was genau ?


Do you wanna show the textdraw to everyone in the car?


Re: One Player Bug. - Justsmile - 31.01.2010

Nein, nur fьr den Fahrer, der Textdraw wird angezeigt, aber er wird nicht geuьpdatet, nur fьr einen Spieler.

No, only for the driver who textdraw appears, but he will not geuьpdatet, except for one player.


Re: One Player Bug. - MenaceX^ - 31.01.2010

Everything but Languages corner must be in English, stop mixing English and German or Dutch, can't understand what it is.


Re: One Player Bug. - ray187 - 31.01.2010

Quote:

Everything but Languages corner must be in English, stop mixing English and German or Dutch, can't understand what it is.

Shush boy. As you can see every line is translated below.


Re: One Player Bug. - ray187 - 31.01.2010

Sry, steh grad aufm Schlauch... ich check dein Problem nicht. Der Textdraw wird nur fьr den ersten Fahrer angezeigt und die restlichen Fahrer sehen ihn nicht?

Sry, am a bit confused and don`t get your problem. The textdraw only gets displayed for the first driver while the others don`t see it?