Home   Help Search Login Register  

Author Topic: this is MY car, not yours  (Read 2071 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:this is MY car, not yours
« Reply #15 on: 22 Apr 2004, 14:48:27 »
ok...now i'm awake and i re-read your last post.....hmm...i think i see through...and surely would do so, but..(there's always a "but") there are a few other scripts that i had to rework then.

And as you say, the way i did will work, i'll keep it this way for now since i have other things to implement first to my map.

But this will be one of the topmost points on my "Tweak and optimize" list.

Thx for your hel pChris, and...pfüeti  ;D

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:this is MY car, not yours
« Reply #16 on: 29 Apr 2004, 01:23:49 »
ok...the first part works...but now i get another problem where i need some help.

The first part..all that what was written before, works well..but now i have to turn around and the problem is....how do i determine in which array a car is in?
Or in other words: who's the car owner?

Ok, i got an array for each civilian in which every vehic he gets is stored

civ1cars
civ2cars
......
and so on

now i have a script which allows to steal a car, so i have to remove the car from his owners array and add it to the "new owner"...the second part (adding) i can handle, but for the first part (remove from previous owner) i need help.

So here's my final question:

How (and please a correct line with syntax and all ;D) do i determine in which array a car is and remove it from there?

Komuna

  • Guest
Re:this is MY car, not yours
« Reply #17 on: 29 Apr 2004, 10:32:03 »
Hey, mates!

I've just read this topic and I think that some of the code is unecessary:

Code: [Select]
if (_x != _vehic) then {_removearray = _removearray + [_x]} forEach _cararray
I see the point. You want to remove a car. Then, all you need is:

_car_array = _car_array - [_car1]

Yes, it is possible. Check out the Command Reference for "array-array" procedures.

About finding a car:
Code: [Select]
_List_of_arrays = ["car_array1","car_array2","car_array3",etc]
{IF (_car_to_be_removed in call _x) THEN {[_car_to_be_removed] call (_x+" = "+_x+" - _this")} } forEach _List_of_arrays
« Last Edit: 29 Apr 2004, 10:36:08 by Komuna »