Evildropbear Posted May 3, 2011 Share Posted May 3, 2011 Hello I'm new to scripting, but wanted to try and see how far I could go scripting my own server. I've been following the wiki for most of it, and currently I'm stuck figuring out how to make the default spawn. I'm following this page: https://wiki.multitheftauto.com/wiki/Resource:Mapmanager Its pretty straight forwards until: Note that "spawnpoint" is the type of the element, used in getElementsByType function; likewise, "id" is used in getElementByID function.To load the map data, the main script needs access to the map resource itself. Now let's edit the script.lua file in "myserver" resource. Enter the following code: Does this mean I have to make the script.lua resource? Or edit an existing one? If I have to create a new one, the wiki says nothing about how to create the meta.xml for it. Link to comment
Castillo Posted May 3, 2011 Share Posted May 3, 2011 Oh really? i think it does https://wiki.multitheftauto.com/wiki/Meta.xml Link to comment
Evildropbear Posted May 3, 2011 Author Share Posted May 3, 2011 Yeah but I meant specifically for that file Would it just be: <meta> <info author="Evildropbear" version="1" name="script" description="Loads co-ordinates from map" type="script"/> <script src="script.lua" type="server"/> </meta> If I use that, and then type in the console 'gamemode myserver mymap' nothing happens Since the files are practically copied straight out of the wiki, I can't really see what might be wrong with them, but I'll post them anyway. mymap.map <map> <spawnpoint id="spawnpoint1" posX="-1986.1390" posY="-1282.9088" posZ="23.9697" rot="63.350006103516" model="0"/> </map script.lua function loadMap(startedMap) mapRoot = getResourceRootElement(startedMap) end addEventHandler("onGamemodeMapStart", getRootElement(), loadMap) function joinHandler() local spawn = getElementsByType("spawnpoint", mapRoot) local x,y,z,r for key, value in pairs(spawn) do x = getElementData(value, "posX") y = getElementData(value, "posY") z = getElementData(value, "posZ") r = getElementData(value, "rot") end spawnPlayer(source, x, y, z) fadeCamera(source, true) end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now