Loop..
#1

pawn Код:
public FLower()
{
    new
        engine,
        lights,
        alarm,
        doors,
        bonnet,
        boot,
        objective,
        vehicleid;

    for (new i = 0, j = GetMaxPlayers(); i != j; i ++)
    {
        if (!IsPlayerConnected(i))
            continue;

        vehicleid = GetPlayerVehicleID(i);
        Carinfo[vehicleid][F] = Carinfo[vehicleid][F] - FUEL_DECREASE;
        TextDrawShowForPlayer(i, vFuel[i]); // Check this line ---------------------------------------------
        TextDrawShowForPlayer(i, Fuel[i]); // Check this line ----------------------------------------------

        if(Carinfo[vehicleid][F] < 1)
        {
            GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);

            Carinfo[vehicleid][F] = 0;
            KillTimer(GasTimer[i]); // THIS LINE------------------------------
            GameTextForPlayer(i, "~r~Vehicle is out of ~w~fuel~r~!", 5000, 5);
            TextDrawHideForPlayer(i, Veh[i]);
            TextDrawHideForPlayer(i, Gear[i]);
            TextDrawHideForPlayer(i, Speed[i]);
            TextDrawHideForPlayer(i, HP[i]);
            TextDrawHideForPlayer(i, vHP[i]);
            TextDrawHideForPlayer(i, vGear[i]);
            TextDrawHideForPlayer(i, vSpeed[i]);
            TextDrawHideForPlayer(i, vName[i]);
            TextDrawHideForPlayer(i, Fuel[i]);
            TextDrawHideForPlayer(i, vFuel[i]);
        }
        if(Carinfo[vehicleid][F] > 95) TextDrawSetString(vFuel[i]," ~g~~n~lllll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 90 && Carinfo[vehicleid][F] < 95) TextDrawSetString(vFuel[i], " ~g~~n~llll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 85 && Carinfo[vehicleid][F] < 90) TextDrawSetString(vFuel[i], " ~g~~n~lll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 80 && Carinfo[vehicleid][F] < 85) TextDrawSetString(vFuel[i], " ~g~~n~ll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 75 && Carinfo[vehicleid][F] < 80) TextDrawSetString(vFuel[i], " ~g~~n~l~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 70 && Carinfo[vehicleid][F] < 75) TextDrawSetString(vFuel[i], " ~n~~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 65 && Carinfo[vehicleid][F] < 70) TextDrawSetString(vFuel[i], " ~n~~n~~y~~h~llll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 60 && Carinfo[vehicleid][F] < 65) TextDrawSetString(vFuel[i], " ~n~~n~~y~~h~lll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 55 && Carinfo[vehicleid][F] < 60) TextDrawSetString(vFuel[i], " ~n~~n~~y~~h~ll~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 50 && Carinfo[vehicleid][F] < 55) TextDrawSetString(vFuel[i], " ~n~~n~~y~~h~l~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 45 && Carinfo[vehicleid][F] < 50) TextDrawSetString(vFuel[i], " ~n~~n~~y~~n~lllll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 40 && Carinfo[vehicleid][F] < 45) TextDrawSetString(vFuel[i], " ~n~~n~~y~~n~llll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 35 && Carinfo[vehicleid][F] < 40) TextDrawSetString(vFuel[i], " ~n~~n~~y~~n~lll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 30 && Carinfo[vehicleid][F] < 35) TextDrawSetString(vFuel[i], " ~n~~n~~y~~n~ll~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 25 && Carinfo[vehicleid][F] < 30) TextDrawSetString(vFuel[i], " ~n~~n~~y~~n~l~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 20 && Carinfo[vehicleid][F] < 25) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~lllll");
        if(Carinfo[vehicleid][F] > 15 && Carinfo[vehicleid][F] < 20) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~llll");
        if(Carinfo[vehicleid][F] > 10 && Carinfo[vehicleid][F] < 15) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~lll");
        if(Carinfo[vehicleid][F] > 5 && Carinfo[vehicleid][F] < 10) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~ll");
        if(Carinfo[vehicleid][F] > 1 && Carinfo[vehicleid][F] < 5) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~l");
        if(Carinfo[vehicleid][F] < 1) TextDrawSetString(vFuel[i], " ~n~~n~~n~~n~~r~|");
    }
    return 1;
}
it's for my project I'm working on the problem is when I sit in car and write /engine it starts a timer based on this callback I posted here, it shows textdraws to all, lowers fuel to all, and so on.. here should be "playerid" insted of loop right?
Reply
#2

Wtf is "j"? lol
Reply
#3

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Wtf is "j"? lol
idk what is j doing there it's not my loop someone made it.. but should be loop here or not?
Reply
#4

Do not use SetTimer: FLower(), use SetTimerEx: FLower (playerid) (ERROR)
Do not use GetMaxPlayers, use MAX_PLAYERS, setting the number of slots.
In this case, instead of new, use static.

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Wtf is "j"? lol
You can use any letter.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)