Need a little help..
#1

Well I need little help with my Filter Script.. I'm almost finished and I think I need to add only this thing:
For example: I'm driving with my car and I spent 50 (from MAX 100) fuel... and if I get out and if I sit in another car it shows 50 fuel (I have textdraws to show level of fuel) so I need to wait 15 seconds (15 seconds is a timer to count down fuel level) so it will update it will new fuel level - 100 MAX

How can I make when I will sit in car it will instantly show it's fuel level so I don't need to wait 15 seconds on fuel update.. here is a code I'm using for fuel going down and so on.. I guess I will need to add a code at "public OnPlayerStateChange(playerid, newstate, oldstate)" but I was thinking a bit how should I do it.. and I just can't figure out :/ Thanks for help in advance

So let me explain again, if I change vehicles it first shows the fuel level value of vehicle I was using before after 15 seconds it shows the new one (timer to lower fuel(public FLower) is set on 15 seconds), how should I make if I sit in new car it will show the current fuel level of this new car, so I don't need to wait 15 seconds so it will "update" it and it will show correct value..

pawn Код:
public FLower(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    Carinfo[vehicleid][F] = Carinfo[vehicleid][F] - FUEL_DECREASE;
    TextDrawShowForPlayer(playerid, vFuel[playerid]);
    TextDrawShowForPlayer(playerid, Fuel[playerid]);
    if(Carinfo[vehicleid][F] < 1)
    {
        new engine,lights,alarm,doors,bonnet,boot,objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        Carinfo[vehicleid][F] = 0;//-----
        KillTimer(GasTimer[playerid]);
        GameTextForPlayer(playerid, "~r~Vehicle is out of ~w~fuel~r~!", 5000, 5);
        TextDrawHideForPlayer(playerid, Veh[playerid]);
        TextDrawHideForPlayer(playerid, Gear[playerid]);
        TextDrawHideForPlayer(playerid, Speed[playerid]);
        TextDrawHideForPlayer(playerid, HP[playerid]);
        TextDrawHideForPlayer(playerid, vHP[playerid]);
        TextDrawHideForPlayer(playerid, vGear[playerid]);
        TextDrawHideForPlayer(playerid, vSpeed[playerid]);
        TextDrawHideForPlayer(playerid, vName[playerid]);
        TextDrawHideForPlayer(playerid, Fuel[playerid]);
        TextDrawHideForPlayer(playerid, vFuel[playerid]);
    }
    if(Carinfo[vehicleid][F] > 95) TextDrawSetString(vFuel[playerid]," ~g~~n~lllll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 90 && Carinfo[vehicleid][F] < 95) TextDrawSetString(vFuel[playerid], " ~g~~n~llll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 85 && Carinfo[vehicleid][F] < 90) TextDrawSetString(vFuel[playerid], " ~g~~n~lll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 80 && Carinfo[vehicleid][F] < 85) TextDrawSetString(vFuel[playerid], " ~g~~n~ll~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 75 && Carinfo[vehicleid][F] < 80) TextDrawSetString(vFuel[playerid], " ~g~~n~l~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 70 && Carinfo[vehicleid][F] < 75) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~h~lllll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 65 && Carinfo[vehicleid][F] < 70) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~h~llll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 60 && Carinfo[vehicleid][F] < 65) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~h~lll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 55 && Carinfo[vehicleid][F] < 60) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~h~ll~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 50 && Carinfo[vehicleid][F] < 55) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~h~l~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 45 && Carinfo[vehicleid][F] < 50) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~n~lllll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 40 && Carinfo[vehicleid][F] < 45) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~n~llll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 35 && Carinfo[vehicleid][F] < 40) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~n~lll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 30 && Carinfo[vehicleid][F] < 35) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~n~ll~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 25 && Carinfo[vehicleid][F] < 30) TextDrawSetString(vFuel[playerid], " ~n~~n~~y~~n~l~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 20 && Carinfo[vehicleid][F] < 25) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~lllll");
    if(Carinfo[vehicleid][F] > 15 && Carinfo[vehicleid][F] < 20) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~llll");
    if(Carinfo[vehicleid][F] > 10 && Carinfo[vehicleid][F] < 15) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~lll");
    if(Carinfo[vehicleid][F] > 5 && Carinfo[vehicleid][F] < 10) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~ll");
    if(Carinfo[vehicleid][F] > 1 && Carinfo[vehicleid][F] < 5) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~l");
    if(Carinfo[vehicleid][F] < 1) TextDrawSetString(vFuel[playerid], " ~n~~n~~n~~n~~r~|");
    return 1;
}
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // If he entered in vehicle and if he is driver
    {
        if(oldstate-1 && newstate)
        {
            TextDrawHideForPlayer(playerid, vName[playerid]);
            TextDrawHideForPlayer(playerid, vSpeed[playerid]);
            TextDrawHideForPlayer(playerid, vGear[playerid]);
            TextDrawHideForPlayer(playerid, vHP[playerid]);
            TextDrawHideForPlayer(playerid, vFuel[playerid]);
            TextDrawHideForPlayer(playerid, HP[playerid]);
            TextDrawHideForPlayer(playerid, Speed[playerid]);
            TextDrawHideForPlayer(playerid, Gear[playerid]);
            TextDrawHideForPlayer(playerid, Veh[playerid]);
            TextDrawHideForPlayer(playerid, Fuel[playerid]);
        }
        if(Carinfo[vehicleid][F] < 1)
        {
            TextDrawHideForPlayer(playerid, vName[playerid]);
            TextDrawHideForPlayer(playerid, vSpeed[playerid]);
            TextDrawHideForPlayer(playerid, vGear[playerid]);
            TextDrawHideForPlayer(playerid, vHP[playerid]);
            TextDrawHideForPlayer(playerid, vFuel[playerid]);
            TextDrawHideForPlayer(playerid, HP[playerid]);
            TextDrawHideForPlayer(playerid, Speed[playerid]);
            TextDrawHideForPlayer(playerid, Gear[playerid]);
            TextDrawHideForPlayer(playerid, Veh[playerid]);
            TextDrawHideForPlayer(playerid, Fuel[playerid]);
            SendClientMessage(playerid, COLOR_YELLOW,"{FF0000}INFO: {FFFFFF}This vehicle is out of fuel, buy gas can at any gas station and refuel it.");
            SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
            return 1;
        }
        else if(Carinfo[vehicleid][F] > 1)
        {
            SendClientMessage(playerid, COLOR_RED,"{FF6A22}INFO: {FFFFFF}Write {FF6A22}/engine {FFFFFF}to turn on engine.");
            return 1;
        }
    }
    return 1;
}
Reply
#2

Reduce the timer of the current fuel. e.g change it to [] seconds. I don't know if that'd work, as I don't do much of that kind of scripting, but it could help!
Reply
#3

I mean 15 seconds is set on "FLower" call back so at every 15 seconds I will get -1 fuel.. If I will set it to 1 sec it will be to fast, thanks for try but I will need some more help
Reply
#4

Sorry buddy. :P
Reply
#5

Anyone please ^^
Reply
#6

bump ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)