Jump to content
pazuzu

Limit Spawning UAV

Recommended Posts

Hello. I'm trying to set up a way to spawn a Greyhawk on my server. I've added an object (phonebooth) with the addaction: this addAction["<t color='#ff9900'>Create Drone</t>", "drone.sqf"];

 

This is the drone script:

myUAV = createVehicle ["B_UAV_02_F", getPos player, [], 0,"FLY"];  
createVehicleCrew myUAV;

Now this works fine but what I want to do is limit the amount of drone spawns or have a timer player has to wait for before spawning another drone. How would I do this?

 

Thank you.

Share this post


Link to post
Share on other sites

This will require player to wait at least 60s between spawning drones.

if (!isNil "myUavLastSpawned" && {myUavLastSpawned > time - 60}) exitWith {
	hint "Try again later";
};

myUavLastSpawned = time;
myUAV = createVehicle ["B_UAV_02_F", getPos player, [], 0,"FLY"];  
createVehicleCrew myUAV;

 

  • Like 2

Share this post


Link to post
Share on other sites
7 hours ago, _foley said:

This will require player to wait at least 60s between spawning drones.


if (!isNil "myUavLastSpawned" && {myUavLastSpawned > time - 60}) exitWith {
	hint "Try again later";
};

myUavLastSpawned = time;
myUAV = createVehicle ["B_UAV_02_F", getPos player, [], 0,"FLY"];  
createVehicleCrew myUAV;

 

This is perfect. Thank you very much.

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

×