Invisible Car Fix
Hello everyone! Have you encountered the issue where you are in an interior (like a stadium) and spawn a car, but it’s not there? It exists, but it has become invisible.
This fix resolves this issue, allowing you to spawn "visible" cars in all interiors.
You can also disable it by entering the cheat code "fixcars," which will trigger a characteristic sound.
For those who want to understand how it works...
Now, let's go step by step. Car spawners do not account for the fact that players can spawn vehicles (and not just cars) in interiors. Because of this, all cars are attached to interior 0 (the street),
but since we are not in interior 0, the car will only be visible in interior 0 (meaning it is "invisible" to us). This is resolved with two lines of code after spawning the vehicle.
Example:
:CarCreating //name of the thread
wait 0 // wait, otherwise the game will freeze
if // if
0ADC: test_cheat "elegy" //cheat code written
jf @CarCreating //otherwise go back to the start of the "CarCreating" thread
jump @CarCreating2 //if the cheat code is written, go to the "CarCreating2" thread
:CarCreating2 //name of the thread
wait 0 //wait, otherwise the game will freeze
model.load(#elegy) //load the model \"elegy\" (car model)
038B: load_requested_models //register the model in the game (without this opcode, the model will not load)
if //if
model.available(#elegy) //model loaded
jf @CarCreating2 //otherwise go back to the start of the "CarCreating2" thread
Car.create(0@ #elegy 1@ 2@ 3@) //create the car
077E: get_active_interior_to $ACTIVE_INTERIOR //check which interior the player is in
0840: link_car 0@ to_interior $ACTIVE_INTERIOR //"attach" (make it visible to us) the car
car.RemoveReferences(0@) //remove info about the car
jump @CarCreating //go to the very beginning of the script
where 0@ - the car itself; #elegy - car model; 1@ 2@ 3@ - variables (in this case - coordinates); $ACTIVE_INTERIOR - variable for the interior number.
These two lines:
077E: get_active_interior_to $ACTIVE_INTERIOR //check which interior the player is in
0840: link_car 0@ to_interior $ACTIVE_INTERIOR //"attach" (make it visible to us) the car
where 0@ - the required vehicle; $ACTIVE_INTERIOR - variable for the interior number.
Make the car "visible" to us. But if we change the interior, the car will become "invisible".
Всем привет! Вы сталкивались с такой проблемой - вы в каком-нибудь интерьере(стадион, например) и заспавнили машину. Но её нет! Вернее она есть, просто стала невидимой.
Данный фикс исправляет эту проблему и вы можете спавнить «видимые» машины во всех интерьерах.
Также это можно отключить, введя чит-код «fixcars», при этом раздастся характерный звук.
Для тех, кто хочет разобраться, как это работает...
Теперь по порядку. Спавнеры машин не учитывают то, что игроки могут спавнить авто(и не только) в интерьерах. Из-за этого все машины прицепляются к интерьеру 0(улица),
но т.к. мы находимся не в интерьере 0, то и видимой машина будет только в интерьере 0(т.е для нас она «невидима»). Все это решается двумя строчками кода после спавна авто.
Пример:
:CarCreating //наименование потока
wait 0 // ждем, в противному случае игра зависнет
if // если
0ADC: test_cheat «elegy» //чит-код написан
jf @CarCreating //в противном случае переходим в начало потока «CarCreating»
jump @CarCreating2 //если чит-код написан, переходим в поток «CarCreating2»
:CarCreating2 //наименование потока
wait 0 //ждем, в противном случае игра зависнет
model.load(#elegy) //загружаем модель \"elegy\"(модель автомобиля)
038B: load_requested_models //регистрируем модель в игре(без этого опкода модель не загрузится)
if //если
model.available(#elegy) //модель загружена
jf @CarCreating2 //в противном случае переходим в начало потока «CarCreating2»
Car.create(0@ #elegy 1@ 2@ 3@) //создаем машину
077E: get_active_interior_to $ACTIVE_INTERIOR //смотрим, в каком интерьере находится игрок
0840: link_car 0@ to_interior $ACTIVE_INTERIOR //\"прицепляем\"(делаем ее видимой для нас) машину
car.RemoveReferences(0@) //удаляем инфу о машине
jump @CarCreating //переходим в самое начало скрипта
где 0@ - само авто; #elegy - моделька авто; 1@ 2@ 3@ - переменные(в данном случае - координаты); $ACTIVE_INTERIOR - переменная номера интерьера.
Всего вот эти две строчки:
077E: get_active_interior_to $ACTIVE_INTERIOR //смотрим, в каком интерьере находится игрок
0840: link_car 0@ to_interior $ACTIVE_INTERIOR //\"прицепляем\"(делаем ее видимой для нас) машину
где 0@ - нужное ТС(транспортное средство); $ACTIVE_INTERIOR - переменная номера интерьера.
Делают авто «видимым» для нас. Но если мы поменяем интерьер, то машина станет «невидимой»