Jump to content
Sign in to follow this  
Guest

Stopping refueling at fuel pumps?

Recommended Posts

Guest

Whats up guys,

I am making a mission which involves having to refuel the car only with the fuel you are given at the start.

Thing is, people can cheat by going to any of the fuel pumps located around takistan (this makes the mission pointless as refueling is a major function of the mission). Anyone know a way of stopping the fuel pumps on the map from being able to refuel the vehicle?

I hope there's a way...

Edited by Guest
Title Change

Share this post


Link to post
Share on other sites

Hi,

this will do the job:

{ _x setFuelCargo 0; } forEach (nearestObjects [player, ["Land_Ind_FuelStation_Feed_EP1"], 10000]);

Share this post


Link to post
Share on other sites

Create a gamelogic or Heli H (Invisible) near the fuel station you'd like to disable, then put the following code into it's initialization field:

((position this) nearestObject 264942) setFuelCargo 0

The number 264942 is the fuel station's object ID. To find a map object's ID just press the "IDs" button in the editor, then zoom in on the fuel station in question.

Edit:

{ _x setFuelCargo 0; } forEach (nearestObjects [player, ["Land_Ind_FuelStation_Feed_EP1"], 10000]);

Yes, this will disable all fuel stations, however a nearestObjects command applied to a radius of 10km causes massive lag.

Generally try to avoid using the nearestObjects command with very large radii.

Share this post


Link to post
Share on other sites
Guest

Thanks guys, much appreciated:)

Share this post


Link to post
Share on other sites

Yea, i know it's not recommended... :D

But i wouldn't consider it massive lag. It takes 2 or 3 seconds to finish the search. I'm using that all the time in my missions. It's barely noticeable.

Share this post


Link to post
Share on other sites
Guest

While we are on the fuel subject, does anyone know how to add increments of fuel?

I currently have this:

[b]Init[/b]
fuel3 distance car1 < 5 and ((getPos (fuel3) select 2) < 0.1)
[b]Condition[/b]
hint "Refuelling..."; car1 setfuel [color="Red"][b]+0.3[/b][/color]; deletevehicle fuel3;

The +0.3 code doesn't work. It just makes the car go down to 0.3 fuel. I would like it to add 0.3 worth of fuel ontop of what is already in the vehicle.

Anyone know how to do this?

Share this post


Link to post
Share on other sites

You first have to get the current fuel value, then add the 0.3 to it.

Like this:

car1 setFuel ((fuel car1) + 0.3);

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×