headscript Posted May 6, 2015 Share Posted May 6, 2015 I don't see any problem in converting it to lua, I'm currently on the way home I can write you a solution then local model = 0 if (PED.IS_PED_MODEL(playerPed, GAMEPLAY.GET_HASH_KEY("player_zero"))) then model = 0 elseif (PED.IS_PED_MODEL(playerPed, GAMEPLAY.GET_HASH_KEY("player_one"))) then model = 1 elseif (PED.IS_PED_MODEL(playerPed, GAMEPLAY.GET_HASH_KEY("player_two"))) then model = 2 end local statname = "SP"..model.."d_TOTAL_CASH" local hash = GAMEPLAY.GET_HASH_KEY(statname) local val = STATS.STAT_GET_INT(hash, 0, -1) Thanks for the help. But val returns "false" for some reason and not the amount of cash for the current character. try local bool, value = STATS.STAT_GET_INT(hash, 0, -1) Link to comment Share on other sites More sharing options...
x_hiro11 Posted May 6, 2015 Share Posted May 6, 2015 (edited) 我不知道如何調整 car fuel bar 的位置,請求增加調整位置的功能 please Edited May 6, 2015 by x_hiro11 Link to comment Share on other sites More sharing options...
sakis25 Posted May 7, 2015 Author Share Posted May 7, 2015 @x_hiro11 you can adjust the position of the fuel bar if you edit the file "FuelScriptV.lua". Find the two lines "gasx" and "gasy" somewhere in the beginning of the code and change it's values from 0 to 1.0. Link to comment Share on other sites More sharing options...
C-h-a-r-l-y Posted May 7, 2015 Share Posted May 7, 2015 @x_hiro11 you can adjust the position of the fuel bar if you edit the file "FuelScriptV.lua". Find the two lines "gasx" and "gasy" somewhere in the beginning of the code and change it's values from 0 to 1.0. I want to pay for gas, please. Link to comment Share on other sites More sharing options...
MADRIZONABRUTA Posted May 7, 2015 Share Posted May 7, 2015 update please Link to comment Share on other sites More sharing options...
sakis25 Posted May 7, 2015 Author Share Posted May 7, 2015 I still can't find way to charge money on gas stations. @headscript code is not working for me. However I will update the Fuel Script later today with some new features including the ability to refill the gas tank using the jerry can. And also I have added a vehicle check for cars and bikes. C-h-a-r-l-y 1 Link to comment Share on other sites More sharing options...
headscript Posted May 7, 2015 Share Posted May 7, 2015 I still can't find way to charge money on gas stations. @headscript code is not working for me. However I will update the Fuel Script later today with some new features including the ability to refill the gas tank using the jerry can. And also I have added a vehicle check for cars and bikes. write me a pm with your skype name and we gonna work a way out together C-h-a-r-l-y 1 Link to comment Share on other sites More sharing options...
maus05 Posted May 7, 2015 Share Posted May 7, 2015 Can you please make that the random value can become a bit different? All cars have a half to a full amount of fuel. Better was 1/10 to full. I have tried myself to put 4 places on the runways for planes to refuel. But i can not refuel any plane. For cars it works. Link to comment Share on other sites More sharing options...
x_hiro11 Posted May 7, 2015 Share Posted May 7, 2015 @x_hiro11 you can adjust the position of the fuel bar if you edit the file "FuelScriptV.lua". Find the two lines "gasx" and "gasy" somewhere in the beginning of the code and change it's values from 0 to 1.0. Thanks a lot!! Link to comment Share on other sites More sharing options...
sakis25 Posted May 7, 2015 Author Share Posted May 7, 2015 Fuel Script 0.5 is now available! What's New in 0.5:- You can now refill your gas tank using the jerry can (hold L near vehicle) (thanks to faztsquirrel)- Blips are now always visible on map and they appear on minimap when you are close enough- Fuel bar now works on cars and bikes only- Hint is now displayed on top left corner when needed- The fuel now lasts longer- Lots of code optimizations- Bug fixes Gollywock and Xilandro 2 Link to comment Share on other sites More sharing options...
Xilandro Posted May 7, 2015 Share Posted May 7, 2015 Fuel Script 0.5 is now available! What's New in 0.5: - You can now refill your gas tank using the jerry can (hold L near vehicle) (thanks to faztsquirrel) - Blips are now always visible on map and they appear on minimap when you are close enough - Fuel bar now works on cars and bikes only - Hint is now displayed on top left corner when needed - The fuel now lasts longer - Lots of code optimizations - Bug fixes Thanks for the amazing update! Link to comment Share on other sites More sharing options...
FowardElement Posted May 7, 2015 Share Posted May 7, 2015 Simply amazing, thank you Link to comment Share on other sites More sharing options...
s2nz0 Posted May 7, 2015 Share Posted May 7, 2015 (edited) There is maybe a wrong gaz station There is nothing there : X: 733.987 Y: -1034.14 Z: 20.9476 The station is more at : X: 817.062 Y: -1030.2 Z: 25.8636 Did you find it and updated it too? I'm going to give a try to the new update Good work Edited May 8, 2015 by s2nz0 Link to comment Share on other sites More sharing options...
xsploit Posted May 8, 2015 Share Posted May 8, 2015 Thanks for releasing the code. Going to have to borrow the waypoint code....going to make a zombie spawn code and it's a good start. I'm just brainstorming now, how i'm going to make em spawn Link to comment Share on other sites More sharing options...
CapYoAzz Posted May 8, 2015 Share Posted May 8, 2015 Bravo! Good job on the mod sakis25 and to those that helped. This mod is really needed for those that like immersion. Once we are able to pay for gas this will be perfect. Q: I'm not at home so I can't test yet but how does the jerry can mechanics work? Does a full can refuel a car completely? Does the mod take into consideration the quantity of fuel left in the jerry can? Link to comment Share on other sites More sharing options...
xsploit Posted May 8, 2015 Share Posted May 8, 2015 (edited) Bravo! Good job on the mod sakis25 and to those that helped. This mod is really needed for those that like immersion. Once we are able to pay for gas this will be perfect. Q: I'm not at home so I can't test yet but how does the jerry can mechanics work? Does a full can refuel a car completely? Does the mod take into consideration the quantity of fuel left in the jerry can? all these little mods like this are perfect for stuff like a life mod, like altis life on arma, especially with Fivem. Hardest thing to do is how you would make moneh. The more immersion the better! Edited May 8, 2015 by xsploit Link to comment Share on other sites More sharing options...
calvooo Posted May 8, 2015 Share Posted May 8, 2015 V0.5, I love it. Link to comment Share on other sites More sharing options...
SiLexBone Posted May 8, 2015 Share Posted May 8, 2015 (edited) @sakis25 May be you can look into the Working Restaurant mod from PlasticTangerine, he managed to get the player pay for food (restoring health). He added the sourcecode to his .asi mod. https://www.gta5-mods.com/scripts/working-restaurants And I think it would be great to have fuel on planes too, we just have to add some refuelling stations... and making them work only for planes. Like making a difference between "kerosene" (aircraft fuel) and normal gas. Would add a little bit more realism no? And actually... thx for this mod, i love it Edited May 8, 2015 by SiLexBone gta4police 1 Link to comment Share on other sites More sharing options...
ZZCOOL Posted May 8, 2015 Share Posted May 8, 2015 (edited) edit posted on the wrong thread Edited May 8, 2015 by ZZCOOL Link to comment Share on other sites More sharing options...
LAZAR2 Posted May 8, 2015 Share Posted May 8, 2015 work great mod Link to comment Share on other sites More sharing options...
s2nz0 Posted May 8, 2015 Share Posted May 8, 2015 (edited) For those who want a red color and a smaller blipsAdd these 2 lines :UI.SET_BLIP_SCALE(blip, 0.8)UI.SET_BLIP_COLOUR(blip, 1)(thx to the guy who showed it first, i just adapted to the new version 0.5)In : function GUI.loadBlips() for i, coords in ipairs(gasStations) do blip[i] = UI.ADD_BLIP_FOR_COORD(coords[1],coords[2],coords[3]) UI.SET_BLIP_SPRITE(blip[i], 361) UI.SET_BLIP_AS_SHORT_RANGE(blip[i], true) UI.SET_BLIP_SCALE(blip[i], 0.8) UI.SET_BLIP_COLOUR(blip[i], 1) endend What would be a cool feature, is that at least 3-4 nearest gaz station show on the minimap when you on low fuel so you don't need to check the entire map, in 0.4 it was showing it, but it was showing too much. To customize even further, you can make the blip appear as red once you on low fuel, and get back the blank blip once you have refuel your car, what do you think about? Anyway great mod i cannot drive without anymore ^^ Edited May 8, 2015 by s2nz0 Link to comment Share on other sites More sharing options...
gta4police Posted May 8, 2015 Share Posted May 8, 2015 Yeah, could you make aircraft refuel too? like landing on of the airports/airstrips and get near on of the hangar/refueling station. Could you also make the refueling process slower so when you are able to make the paying system, the fuel bar will only be filled based on until how much you afford the fuel? Is the fuel also saved on saved vehicles, so when you sleep/save, you still have the same fuel level from the last time you drove the vehicle? Could you add animations when you are refueling your car with the jerrycan? Link to comment Share on other sites More sharing options...
sakis25 Posted May 8, 2015 Author Share Posted May 8, 2015 This is from an older version of the mod but it is a great one: Link to comment Share on other sites More sharing options...
Nzxt Posted May 8, 2015 Share Posted May 8, 2015 When I start the game I get a prompt system window with LUA plugins. Is normally? Link to comment Share on other sites More sharing options...
sakis25 Posted May 9, 2015 Author Share Posted May 9, 2015 (edited) When I start the game I get a prompt system window with LUA plugins. Is normally? You have the SDK version of the LUA Plugin. Download the normal version. Mods please change the title of this thread to "Fuel Script V Mod" Edited May 9, 2015 by sakis25 Link to comment Share on other sites More sharing options...
faztsquirrel Posted May 9, 2015 Share Posted May 9, 2015 (edited) Hi sakis25,I have a couple of suggestions for stuff to implement to the mod, it is turning in such an awesome mod! (I've made sure those things are even codeable first, my version is linked again.) Anyways my list of suggestions: Add more comments, 0.5 was a bit hard to read. Keep track of multiple cars by inserting them into a table. Rebindable keys! Make fuel drain faster on cars with damaged engines. Optimize code. The complete Lua version: http://pastebin.com/4YcU7KnA http://pastebin.com/UMSyrEi1 (UPDATED) Suggestions explained in code: Multiple cars: local cars = {}-- If vehicle has changedif not cars[1] or cars[1].pointer ~= veh then local found = false local emptyfound = false -- Check if current vehicle is used before for key, value in pairs(cars) do if value.pointer == veh then -- Has been in this car before found = true local temp = table.remove(cars, key) table.insert(cars, 1, temp) break else -- Check if vehicle still exists, if not then make a possible value if there is no other one (really sloppy) if not ENTITY.DOES_ENTITY_EXIST(value.pointer) then value = {veh, fuel=math.random(6,12)/100} emptyfound = true end end end if ( not found ) then -- There is a possible value from earlier if ( emptyfound ) then for key, value in pairs(cars) do if not ENTITY.DOES_ENTITY_EXIST(value.pointer) then table.remove(cars, key) end end else -- Remove cars if we are over the 10 cars limit if ( #cars > 10 ) then table.remove(cars, 1) end end -- Insert current car at pos #1 table.insert(cars, 1, {pointer=veh, fuel=math.random(6,12)/100}) endend Rebindable keys: local refuelKey = Keys.Lget_key_pressed(refuelKey) Fuel drains faster on damage: local carHealth = VEHICLE.GET_VEHICLE_ENGINE_HEALTH(cars[1].pointer) -- 1000 = maxcars[1].fuel = cars[1].fuel - ((carspeed/450000.0) * (900.0/carHealth)) Hope it helps! EDIT: had to add the , 1 to the first table.insert, otherwise it would move the current car to the back of the table, instead of the front Edited May 10, 2015 by faztsquirrel Daxwolf 1 Link to comment Share on other sites More sharing options...
maus05 Posted May 9, 2015 Share Posted May 9, 2015 Ok, in my opinion it is not so real world like when a car with outside damage drains more fuel but it would be good if the fuel rans completely out when the car you drive have a hole in the fuel tank. Link to comment Share on other sites More sharing options...
sakis25 Posted May 10, 2015 Author Share Posted May 10, 2015 Hi sakis25, I have a couple of suggestions for stuff to implement to the mod, it is turning in such an awesome mod! (I've made sure those things are even codeable first, my version is linked again.) Anyways my list of suggestions: Add more comments, 0.5 was a bit hard to read. Keep track of multiple cars by inserting them into a table. Rebindable keys! Make fuel drain faster on cars with damaged engines. Optimize code. The complete Lua version: http://pastebin.com/4YcU7KnA Suggestions explained in code: Multiple cars: local cars = {}-- If vehicle has changedif not cars[1] or cars[1].pointer ~= veh then local found = false local emptyfound = false -- Check if current vehicle is used before for key, value in pairs(cars) do if value.pointer == veh then -- Has been in this car before found = true local temp = table.remove(cars, key) table.insert(cars, temp) break else -- Check if vehicle still exists, if not then make a possible value if there is no other one (really sloppy) if not ENTITY.DOES_ENTITY_EXIST(value.pointer) then value = {veh, fuel=math.random(6,12)/100} emptyfound = true end end end if ( not found ) then -- There is a possible value from earlier if ( emptyfound ) then for key, value in pairs(cars) do if not ENTITY.DOES_ENTITY_EXIST(value.pointer) then table.remove(cars, key) end end else -- Remove cars if we are over the 10 cars limit if ( #cars > 10 ) then table.remove(cars, 1) end end -- Insert current car at pos #1 table.insert(cars, 1, {pointer=veh, fuel=math.random(6,12)/100}) endend Rebindable keys: local refuelKey = Keys.Lget_key_pressed(refuelKey) Fuel drains faster on damage: local carHealth = VEHICLE.GET_VEHICLE_ENGINE_HEALTH(cars[1].pointer) -- 1000 = maxcars[1].fuel = cars[1].fuel - ((carspeed/450000.0) * (900.0/carHealth)) Hope it helps! You did your magic again my friend. However I tested your code and I found that it not keeping track of multiple cars. I'm not sure why. Also I agree with @maus05 it's not that realistic to lose more fuel if your car is damaged outside. Link to comment Share on other sites More sharing options...
faztsquirrel Posted May 10, 2015 Share Posted May 10, 2015 The code for multiple cars is only to keep track of them, you need to replace all the carGas value with cars[1].fuel to make it use the table instead of the old system. Or was my lua script not working for you? Link to comment Share on other sites More sharing options...
80T Posted May 10, 2015 Share Posted May 10, 2015 1. Is it possible to add "Idle consumption" for stationary cars that were left with the engine running or cars moving from inertia ? Ex. 5~10% consumption for a stationary car with the engine running or a car that it's moving from inertia (not pressing gas pedal) Also burnouts or drifting generally (with full throttle) would consume 25% more than normal (125% fuel consumption) 2. Is it possible to differentiate different vehicles class fuel tank capacity and make the refuel longer/shorter by class ? Ex. A fuel canister would refill a bike's tank at 100% but it would only refill ~25% of an SUV or ~33% of a sedan, etc... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now