Jump to content

creating cars


Recommended Posts

I'm trying to create cars that spawn on the map.

What lua file do I put the command in?

How do I call up that command so the cars will spawn?

I'm really lost on this, I have a basic server and have admin access but I don't know what to do next to have cars spawn.

I think maybe I need to make a map file with the cars in it and load it as part of a resource. Is this right?

Please help.

Grievous

Link to comment

For vehicles that are a "permanent" part of the server/gamemode/map/whatever, you should use vehicle tags in a map. More info about this can be found on the wiki, but the basic syntax is:

<vehicle model="" posX="" posY="" posZ="" rotX="" rotY="" rotZ="" color="" upgrades="" paintjob="" plate="" turretX="" turretY="" health="" sirens="" landingGearDown="" specialState="" locked="" interior="" dimension=""/> 

Link to comment

...

I created this map file to spawn a car in the police parking garage but it didn't create the car.

I have it in a folder under resoucres along with a meta.xml

and a script.lua file

function joinHandler()

local x = 1580.55

local y = -1634.46

local z = 14

spawnPlayer(source, x, y, z)

setPlayerSkin(playerSource, 280)

fadeCamera(source, true)

setCameraTarget(source, source)

outputChatBox("Welcome to My Server", source)

end

addEventHandler("onPlayerJoin", getRootElement(), joinHandler)

I get CJ but no car. Maybe I need more data in the map file? please help

Link to comment

*HINT* Use the "Code" button to make some pieces a little easier to read.

<meta> 
  
<info author="grievous" type="gamemode" name="police" description="Los Santos Police" /> 
<script src="script.lua" /> 
  
  
</meta> 

You're forgetting to do :roll:

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...