target: when car created, save it in list, so i can use it, when player sit in it.
key problem: "event.createdentity" not not equal to "game.player.character.vehicle"
how i try do it:
1. on "car create" i save it link on enity in table
Code: Select all
cars_data.m.add( event.createdentity )
Code: Select all
function cars_data.m.add(_owner)
local new_car_data ={}
new_car_data['owner'] = _owner
Code: Select all
if game.player.character and game.player.character.vehicle then
gui_car = cars_data.m.get( game.player.character.vehicle)
Code: Select all
function cars_data.m.get(_owner)
local rez=nil
local cardata= nil
local t=0
for t,cardata in pairs(cars_data.data) do
if cardata['owner'] == _owner then
rez = cardata
game.player.print( 'rez = cardata' )
end
end
return rez
end
"event.createdentity" and "game.player.character.vehicle" are valid, have same types, work same and ets.
but they are not equal.
I'm doing something wrong?