SCars for Darkrp Help

So I installed SCars on my Darkrp server, but when I try the usual AddCustomVehicle code like this.


AddCustomVehicle("Yamahayfz350", "models/tiggogm/vehicles/yamahayfz450.mdl", 5500)

It doesn’t spawn the vehicle from the F4 menu when I click it. I also tried making it in the AddEntities, but that just ended up say /buyyamaha.
I am assuming this is because SCars are in their own tab, but if anyone knows how to fix this please let me know.

Thanks

Hi,

I found this on Gmod Wiki:


AddCustomVehicle(<One of the vehicles from the rp_getvehicles list>, <Model of the vehicle>, <Price of the vehicle>, <OPTIONAL jobs that can buy the vehicle>)

When you type rp_getvehicles list on your console, did you see your car?

No that’s the problem, the SCars are in their own tab in the Q menu so when I type in rp_getvehicles it only gets me the cars in the vehicles tab.

The problem with SCars is that they need to be spawned in a special way, which means you need to edit some of the spawning code.

Not really sure how to do that. :frowning:
Kind of a noob with codes.

Here is a code to spawn a car at looking position :


function spawncar( ply ) -- The function
	
	spawncar= ents.Create("prop_vehicle_jeep") -- Always need this for a vehicle
	spawncar:SetModel("models/.../...") -- model of the vehicle
	spawncar:SetKeyValue("vehiclescript", "scripts/vehicles/.../...") -- script of the vehicle
	spawncar:SetPos( ply:GetEyeTrace().HitPos ) -- Will spawn the vehicle at the looking position
	spawncar:Spawn() -- Spawn the vehicles
	
 
end
concommand.Add("SpawnCAR", spawncar)

Btw, you can change the ply:GetEyeTrace().HitPos by a vector !

me i have added scars on my darkrp use this:

//Ford GT example
AddEntity(“Ford GT”, {
ent = “sent_sakarias_car_fordgt”,
model = “models/Splayn/fordgt.mdl”,
price = 1000,
max = 1,
cmd = “/buyfordgt”
})

Put this on addentities.lua

I think your script is better for a darkRP :slight_smile:

( I never use a DarkRP lol )

It still does it tho.


me i have added scars on my darkrp use this:

//Ford GT example
AddEntity("Ford GT", {
ent = "sent_sakarias_car_fordgt",
model = "models/Splayn/fordgt.mdl",
price = 1000,
max = 1,
cmd = "/buyfordgt"
})

Put this on addentities.lua 

Awesome works perfectly. Thanks!
And you said you had a Darkrp server with SCars right? How or did you make it so the cars could be locked? Because When I try on a f4 menu spawned car it just doesn’t lock it.

Yes is can’t be locked because its spawned as a worldprop i will find a way to spawn them as a user prop :slight_smile:

(If any know for basewars i need help check post here: http://forum.facepunch.com/showthread.php?t=1239290&p=39204809#post39204809)