SA-MP Forums Archive
Fuel[rep] - 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)
+--- Thread: Fuel[rep] (/showthread.php?tid=326967)



Fuel[rep] - Dan_Barocu - 19.03.2012

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?


Re: Fuel[rep] - Mauzen - 19.03.2012

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.


Re: Fuel[rep] - Dripac - 19.03.2012

Use HideTextdrawForPlayer under OnPlayerVehicleExit, or check the state


Re: Fuel[rep] - Dan_Barocu - 19.03.2012

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



Re: Fuel[rep] - Mauzen - 19.03.2012

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.


Re: Fuel[rep] - Dan_Barocu - 19.03.2012

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


Re: Fuel[rep] - Dan_Barocu - 19.03.2012

how can i create the fuel in textdraw can someone help?


Re: Fuel[rep] - Dan_Barocu - 19.03.2012

BUMP.