Jump to content
Sign in to follow this  
Antorugby

Nearestobjects

Recommended Posts

Hello, I'm trying to make a towing script but I'm pretty new at scripting so I need some help, here's my code

_vehicletow = vehicle player;
_towarray = nearestObjects [ _vehicletow, ["Car"], 10]; 
if (count _towarray > 0 ) then { 
tow = player addAction ["Tow", "towing.sqf"];
};

But it's not working, if I use player instead of _vehicletow is working, what am I missing?

Share this post


Link to post
Share on other sites

Yeah, but I found a script from BTC, so I don't need it anymore.

Inviato dal mio GT-I9300 con Tapatalk

Share this post


Link to post
Share on other sites

I'm not good at scripting but try this:

_vehicletow = vehicle player;
_towarray = nearestObjects [ _vehicletow, ["Car"], 10]; 
if (count _towarray > 0 ) then { 
tow = _vehicletow addAction ["Tow", "towing.sqf"];
};

You may need to add a private array, but I'm not sure:

private ["_vehicletow","_towarray"];
_vehicletow = vehicle player;
_towarray = nearestObjects [ _vehicletow, ["Car"], 10]; 
if (count _towarray > 0 ) then { 
tow = _vehicletow addAction ["Tow", "towing.sqf"];
};

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  

×