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

@Streetcorps didn’t u fix this issue with the taxi resource ?

well if you can post the fix that would be cool because idk how and yes i got the same issue for the second player jumping in the car @GanjaMonster @SorensenDK

Are you talking about this ( [Release] Simple Taxi Work [UPDATED] )?

If so, I checked the code, and that doesn’t even spawn any cars. It only checked if you’re in a specific vehicle.

@Antoine, I can take a look into it. It is something I would like to do in my server as well. Just never really got around to doing it.

1 Like

it spawns two taxis at the downtown cab place but you would have to ask @Streetcorps

ok cool sound good i will be in touch

Unless he released a new script (which I can’t find), that script does not spawn taxis.

in one of the first version yes whit npc but its not there anymore

To spawn car you should use this script

local carmodel = GetHashKey("taxi")
							RequestModel(carmodel)
							while not HasModelLoaded(carmodel) do
								Citizen.Wait(0)
							end
							car = CreateVehicle(carmodel, x,y,z,a, true, false)
Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(car))

Do not forget Citizen.InvokeNative(0xB736A491E64A32CF,Citizen.PointerValueIntInitialized(car)) , to clear memory.

1 Like

@MarkViolla - The issue is, we want to have cars spawn when the resources starts, but if there are multiple players, the car will spawn multiple times. Do you have any idea for how to do a check to make sure the car does not spawn more than once?

Yes, you create an event that you can trigger with a command, don’t give away the command , run it when the server is starting and thats it or add it as an admin command if you use em or if you created your own admin system

Yes. Look at mapmanager resource for information how it works.
I am from mobile,so i cant give you example.

@hbk I’d really prefer for it to be an automated process immediately on server start.

@MarkViolla I’ve tried adding in cars using the mapmanager, but it doesn’t even allow me to join the game.

@Briglair, Ok. Later. I know what to do.

@MarkViolla Awesome. Thanks, Mark!

ty guys for all that :stuck_out_tongue:

Easy: only spawn the car if there isn’t a car in the area already. I don’t know how migration handles this (if the car will be seen as existent, even), but IS_ANY_VEHICLE_NEAR_POINT could help.

1 Like

@ Briglair: As I see it … The server spawns three cars in the room at the car dealer. My friend and I spawn another place and go together to the car dealer. I stand and look at that he goes into one of the cars. Immediately he begins to ‘jump around’ in the car until he gets out again.
The same happens if he looks and I go into one of the cars? We use cars elsewhere in the system, but it is only with these cars this happens. Therefore, I believe that there is something wrong with the ‘spawn method’ in the script :slight_smile:.

@ Briglair: Ohh … I was too quick when I read your answer. Fully okayy :relaxed:

@SorensenDK - Yes, you are correct. When the car is spawned, it is not enabled with the network. Meaning, that car only exists on YOUR screen. It does not exist on your friend’s screen. You friend also sees a car, but it is a different car. It is the same model, but a completely different entity. It is not synced.

@promethium Worth a shot to try and prevent simultaneous spawning.

Also has a couple other ideas. Although a host really isn’t used (that I know of), the script still finds a host and selects one. We could make it only run if the player is host. Or if that doesn’t work, have a loop on the server to run every several seconds that gets all players. Have it trigger client event only once on the first player. Then after either of these ideas, it would set that variable so it won’t be run again.

@ Briglair: Okayy I see… :relaxed:.

As I wrote earlier. I will only use them as a ‘decoration’ in car shop, so If there was a way to “lock” them, so I can use the script as it is now. You do not steal the cars on display in a store, right? :grinning:

That should work for you, yes. After the car is spawned, you can use SetVehicleDoorsLocked(vehicle, doorLockStatus). The diffetent lock statuses are: (from http://www.dev-c.com/nativedb/ )
0 - CARLOCK_NONE
1 - CARLOCK_UNLOCKED
2 - CARLOCK_LOCKED (locked)
3 - CARLOCK_LOCKOUT_PLAYER_ONLY
4 - CARLOCK_LOCKED_PLAYER_INSIDE (can get in, can’t leave)

(maybe, these are leftovers from GTA:VC)
5 - CARLOCK_LOCKED_INITIALLY
6 - CARLOCK_FORCE_SHUT_DOORS
7 - CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED

(source: GTA VC miss2 leak, matching constants for 0/2/4, testing)

2 Likes