Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fnc_p2CountStaticVehicles = {
- private["_vehCount","_list","_charId"];
- _vehCount = 0; //start with 0
- _list = ([0,0,0]) nearEntities [[_this], 25000]; //for each vehicle that already exists (within 25000m) with input classname (_this)
- {
- _vehCount = _vehCount + 1; //add 1 to vehicle count
- _charId = (_x getVariable ["CharacterID", 0]); //check if this vehicle was purchased using char id
- if (typeName _charId == typeName "") then {
- _charId = parseNumber _charId; //if charId is a string, convert it to a number
- };
- if (_charId > 0) then {
- _vehCount = _vehCount - 1; //if charId greater than 0, vehicle was purchased, take the 1 away from the vehicle count
- };
- } forEach _list; //end of for each vehicle that already exits
- //return the amount of vehicles it counted
- _vehCount
- };
- //call the function using Ka52 as input, store result as _result
- _result = "Ka52Black" call fnc_p2CountStaticVehicles;
- //output result to logs
- diag_log str _result;
- //In log we see: "1", as there is 1 Ka52Black on the map that is not trader purchased
Advertisement
Add Comment
Please, Sign In to add comment