[Release] SecretCars > car only in local need to be fix

Hi everyone if you want some secret car in your map here we go !

__resource.lua

client_script "client.lua"

client.lua

Citizen.CreateThread(function()
-- Parked vehicles.
  local vehicles = {
    -- Locations
    {Model= "tyrus", X= 2669.716, Y= 3517.079, Z= 51.981, A= 0},
    {Model= "tyrus", X= 2673.525, Y= 3526.788, Z= 51.710, A= 0},
  }

 -- Spawn the secret cars
 for _, item in pairs(vehicles) do
   RequestModel(GetHashKey(item.Model));
   while not HasModelLoaded(GetHashKey(item.Model)) do
     RequestModel(GetHashKey(item.Model));
     Wait(1);
  end

  vehicle = CreateVehicle(GetHashKey(item.Model), item.X, item.Y, item.Z, item.A, false, false)
  SetVehicleOnGroundProperly(vehicle)
 end
end)

Create a folder in your ressource ( secretcar ). Dont forget to put the file name in your ( citmp-server.yml )

This is the secret cars location. You can change the location/car for whatever you want and have fun :blush:

feel free to make the script better :wink:

Issue: Car only in Local

2 Likes

this can be used instead of trainer cars being spawned also if you spawned enough of them around the map etc a lot of work but we can get a lot in just this one resource :wink:

1 Like

i agree whit you @GanjaMonster

@Antoine do you know if addon cars work ?

idk i never use add on I only use skin replace !

well its going to be a long night i guess xD

1 Like

hah yeah im use to that :stuck_out_tongue:

I’m not too familiar with spawning cars and all, but wouldn’t this cause every client to spawn a car in that location resulting in multiple cars for the one spot?

thats true idk need to chk that for sure im gonna test that right now and im trying to make a respawn time

The code seems to use false for the network flag, which means the car won’t sync at all unless another function gets called to create a network object upon entering.

There’s a few other ways to only create an object once, if need be we could name some of them soon.

1 Like

i test a few time whit poeple and the car dont spawn multiple time need to make more test for sure

and yes if you have anything better im all yes

Works fine and thanks for a fine Releases, but I will only use the cars as decoration in the car shop, how can I “lock” them so they can not run ? :wink:…

1 Like

yea that would be a great idea but idk maybe possible , but good to populate the map like police stations , constructions sites , maybe make custom scenarioos car meets etc looks like a lot of potential

1 Like

that a good idea but i dont know how to lock all vehicles doors

Best way would be to set the vehicles fuel to 0 then it wouldn’t start but you can still get in and look at the interior of the vehicle.

Very good idea, but how do I do that ?? :confused:…

I have observed and I think there maybe is a ‘spawn problem’ with the cars :confused:.
When I mount and sit in the car, everything (almost everything) looks normal except that I can not use the ‘first person view’. But when I stand and look at my friend gets in, he ‘jumps’ very quickly up and down inside the car, like he ‘mounts wrong’, therefore I think there is something wrong in the fine script ? :disappointed:

the tyrus dont have the first person change the car and you will see

Okayy, but what about my ‘jumping friend’, something is also wrong there ? Have you tested the cars together with an another person (inside the game)? Because solo there is no problem?