Entity owning help!

Is it possible to set the owner of the entity im spawing in this example?

[LUA] function SpawnCar(ply, ent)
local Car = ents.Create(“sent_sakarias_car_junker1”)
Car:SetPos(table.Random(CarSpawn))
Car:SetAngles(carang[1].ang)
Car.Owner = (ply)
Car:Own(ply)
Car:Spawn()
Car:Activate()[/LUA]

Yes, this is SCars. Im trying to make a Vehicle Terminal where you can buy cars. I just wanted to know if there is a way to make the vehicle spawn in the name of the person spawning it through the function.

I don’t know will it work with scars

For what reason would it not? At the end of the day, it is just another entity.

Somebody got some ideas? I just need them to get the own right to the car instead of it being spawned as world prop, or without an owner. Or is there other ways of spawing the entity, i got no idea. Thanks in advance!

Vehicle spawning is not as simple as ents.Create.
It involves keyvalues and such.

Give me 2 minutes to pull up some old code as an example.

[editline]22nd January 2013[/editline]

[lua] local Car = ents.Create( “prop_vehicle_jeep” )
Car:SetKeyValue( “vehiclescript”, v[6] )
Car:SetPos( _SpawnPos )
Car:SetModel( v[2] )
Car:Spawn()
Car:Activate()
Car:SetHealth(100)
Car.Owner = ply
ply:EnterVehicle(Car)
Car:Own(ply)[/lua]

Is just odd how Scars is since its not a Vehicle but a entity, or whatever. Im just confused how to use this with Scars, since it dosent have a Vehicle script.

If you’re using a prop protection that’s using CPPI you can do:
[lua]self:CPPISetOwner(owner)[/lua]

In the ENT:Initialize() function

I dont think you can use KeyValues when its Scars.