How do i make a variable of a spawned car?



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.


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

any clues?


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:


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)


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


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