How do i make a variable of a spawned car?

help

#1

Hello, Anyone here know how to make this a variable?
CreateVehicle(1912215274, CarSpawn.X, CarSpawn.Y, CarSpawn.Z, CarSpawn.Heading)

i want to use this code below but can’t get the ped to goto the vehicle because i dont have a variable for it like i have for the ped i created.

TASK_GO_TO_ENTITY

TaskGoToEntity(Entity entity, Entity target, int duration, float distance, float speed, float p5, int p6)

any clues?


#2

I’m assuming you’re using LUA, so you should just be able to do something along the lines of

local varName

varName = CreateVehicle(…)

I haven’t been around for a couple weeks so someone let me know if I’m mistaken :ok_hand:


#3

I did try that, but it didn’t spawn the car.

I made my ped like that, so thats why i have a Variable of the ped
local copPed = CreatePed(PED_TYPE_COP, -1920001264, CopSpawn.X, CopSpawn.Y, CopSpawn.Z, CopSpawn.Heading, true, false)


#4

Okey so i had “local” in the begining of the variable, i tried to remove it and it seemed to fix my problem, the car spawned and it has a variable, thank you for your help Zulfurix


#5

Not a problem, glad I could help!:slightly_smiling_face: