Fuel[rep]
#1

i made an fuel sistem..and if i get off vehicle the fuel thing doesent get off the screen..only after 10 minutes..as same if i go on vehicle..can someone tell me what to do?
Reply
#2

Take a look at this callback: https://sampwiki.blast.hk/wiki/OnPlayerStateChange
With this you can detect when a player enters or leaves a car, and show/hide the fuel infos then.
Reply
#3

Use HideTextdrawForPlayer under OnPlayerVehicleExit, or check the state
Reply
#4

look it already has it..

PHP код:
    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);
                                        if(
Gas[vehicle] >= 1)
                                           {
                                               if(
Gas[vehicle] <= 10)
                                            {
                                                   
PlayerPlaySound(i10850.00.00.0);
                                                   if(
gGas[i] == 0) {
                                                       
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel is low",5000,3);
                                                }
                                            }
                                               if(
gGas[i] == 1) {
                                               if(
IsAPlane(vehicle) || IsABoat(vehicle) || IsABicycle(vehicle) || IsASweeper(vehicle))
                                               {
                                                  
format(stringsizeof(string), "~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fuel:~w~ N/A");
                                            }
                                            else
                                            {
                                                
format(stringsizeof(string), "~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~F~y~u~b~e~p~l~w~:~r~ %d%",Gas[vehicle]);
                                            }
                                              
GameTextForPlayer(i,string,20500,3); }
                                            if(
IsAPlane(vehicle) || IsABoat(vehicle) || IsABicycle(vehicle) || IsASweeper(vehicle)) { Gas[vehicle]++; }
                                              
Gas[vehicle]--;
                                           }
                                           else
                                           {
                                              
NoFuel[i] = 1;
                                              
TogglePlayerControllable(i0);
                                            
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~No fuel in Vehicle",1500,3);
                                        }
                                    }
                                }
                            }
                            return 
1;
                        } 
Reply
#5

Better use TextDraws for constant things like displaying fuel. Isnt hard to change, and you can simply hide and show textdraws without setting a time.
Reply
#6

the thing is.. i dont know how to create a textdraw like this only what i made i know..
Reply
#7

how can i create the fuel in textdraw can someone help?
Reply
#8

BUMP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)