Jockie Posted February 19, 2010 Share Posted February 19, 2010 (edited) I have a little problem with the Freeroam resource. I've created a little teleport menu inside the freeroam resource, copied the interior part, it's ''almost'' the same with what I need. I've also added a new .xml with all the locations. But when I start the resource, it says: "locations.xml could not be opened." Idk what the problems are. >.> function setLocation(leaf) server.setElementInterior(g_Me, leaf.world) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then server.setElementInterior(vehicle, leaf.world) for i=0,getVehicleMaxPassengers(vehicle) do local player = getVehicleOccupant(vehicle, i) if player and player ~= g_Me then server.setElementInterior(player, leaf.world) server.setCameraInterior(player, leaf.world) end end end setCameraInterior(leaf.world) setPlayerPosition(leaf.posX, leaf.posY, leaf.posZ + 1) closeWindow(wndSetLocation) end wndSetLocation = { 'wnd', text = 'Set location', width = 250, controls = { { 'lst', id='locations', width=230, height=300, columns={ {text='Location', attr='name'} }, rows={xml='locations.xml', attrs={'name', 'posX', 'posY', 'posZ', 'world'}}, onitemdoubleclick=setLocation }, {'btn', id='close', closeswindow=true} } } The locations.xml is something like this: <catalog type="location"> <location name="Test" posX="-1499.2492675781" posY"-214.14785766602" posZ"14.383546829224" world="0"/> </catalog> I'm a beginner, so don't laugh. Grtz, Jockie. (^.^)-b Edited March 4, 2010 by Guest Link to comment
Aibo Posted February 19, 2010 Share Posted February 19, 2010 have you added locations.xml to meta.xml of the resource? Link to comment
Jockie Posted February 19, 2010 Author Share Posted February 19, 2010 Ye, same as the other XML files, client side. The ''close'' button is also not showing of this little menu. This is what I get. http://img27.imageshack.us/img27/349/screeniei.png Link to comment
50p Posted February 19, 2010 Share Posted February 19, 2010 Trace the error. Basically, debug the script. I wouldn't recommend to learn from or modify freeroam resource because it's not easy to read its code. It's not made for beginners to learn from it. The message is surely from freeroam resource not MTA that's for sure, so find the function which shows you that message and debug it. There is nothing wrong with your code. Maybe you added your changes but didn't restart the resource after it? Link to comment
Jockie Posted February 20, 2010 Author Share Posted February 20, 2010 (edited) I've restarted the server everytime when I've installed/modified a resource. But with this one, it isn't working at all... I'll look for the error, thx for the info. EDIT: Found the bug <catalog type="location"> <location name="Test" posX="-1499.2492675781" posY"-214.14785766602" posZ"14.383546829224" world="0"/> </catalog> It has to be... (somehow ''weird way) (Also forgot some =) <catalog type="interior"> <interior name="Test" posX="-1499" posY="-214" posZ="15" world="0"/> </catalog> Edited March 1, 2010 by Guest Link to comment
Jockie Posted March 1, 2010 Author Share Posted March 1, 2010 I've found a bug.. I think. server.setElementInterior is working without any problems, its changes the interior. function setLocation(leaf) server.setElementInterior(g_Me, leaf.world) But when I replace it with server.setElementDimension: function setLocation(leaf) server.setElementDimension(g_Me, leaf.world) The script will not change the dimension of the element/player. Link to comment
50p Posted March 1, 2010 Share Posted March 1, 2010 I've found a bug.. I think. server.setElementInterior is working without any problems, its changes the interior. function setLocation(leaf) server.setElementInterior(g_Me, leaf.world) But when I replace it with server.setElementDimension: function setLocation(leaf) server.setElementDimension(g_Me, leaf.world) The script will not change the dimension of the element/player. It will not change the interior but will change dimension. What's the point of changing dimension without changing interior or what's the point of setting player's dimension to the id of interior? No matter what entrance player enters, he will be set to that interior and so will be player's dimension. Link to comment
Jockie Posted March 1, 2010 Author Share Posted March 1, 2010 function setLocation(leaf) server.setElementInterior(g_Me, leaf.world) server.setElementDimension(g_Me, leaf.dimension) setPlayerPosition(leaf.posX, leaf.posY, leaf.posZ + 1) closeWindow(wndSetLocation) end So it needs to look like this.. But still the dimension is not changing, only the interior.. Link to comment
50p Posted March 2, 2010 Share Posted March 2, 2010 function setLocation(leaf) server.setElementInterior(g_Me, leaf.world) server.setElementDimension(g_Me, leaf.dimension) setPlayerPosition(leaf.posX, leaf.posY, leaf.posZ + 1) closeWindow(wndSetLocation) end So it needs to look like this.. But still the dimension is not changing, only the interior.. Is there anything like leaf.dimension. I didn't say not to learn from freeroam resource without reason. It's just not for rookies. Link to comment
Jockie Posted March 4, 2010 Author Share Posted March 4, 2010 First, I'm not a rookie (anymore)... Second, yes I've added a leaf.dimension and added it to the .XML file and a somewhere else. So, this is the part of the script that's done, but still setElementDimension is not working... And Yes.. I've added these scripts to meta.xml. This is the a part of the edited Freeroam. function setCurrentGame(leaf) server.setElementInterior(g_Me, leaf.world) server.setElementDimension(g_Me, leaf.dimension) local vehicle = getPedOccupiedVehicle(g_Me) if vehicle then outputChatBox("Get out of your vehicle.") return end setCameraInterior(leaf.world) setPlayerPosition(leaf.posX, leaf.posY, leaf.posZ + 1) closeWindow(wndSetCurrentGame) end wndSetCurrentGame = { 'wnd', text = 'Minigames List', width = 250, controls = { { 'lst', id='minigames', width=230, height=300, columns={ {text='Minigame', attr='name'} }, rows={xml='minigames.xml', attrs={'name', 'posX', 'posY', 'posZ', 'world', 'dimension'}}, onitemdoubleclick=setCurrentGame }, {'btn', id='close', closeswindow=true}, {'lbl', text=' Double click to join'} } } Part of the minigames.xml file <catalog type="interior"> <group name="Test 1"> <interior name="Spawn 1" posX="1304.5737304688" posY="2107.1997070313" posZ="11.015625" world="0" dimension="101"/> <interior name="Spawn 2" posX="1382.9158935547" posY="2184.7958984375" posZ="11.0234375" world="0" dimension="101"/> <interior name="Spawn 3" posX="1410.544921875" posY="2102.7780761719" posZ="12.015625" world="0" dimension="101"/> <interior name="Spawn 3" posX="1298.2655029297" posY="2211.9970703125" posZ="12.015625" world="0" dimension="101"/> </group> </catalog> So I want that the players will spawn in Interior 0(outside) and dimension 101. But the player is always spawning in Dimension 0 of Interior 0. EDIT: Ahaahh... @ Server-side: I just needed to add this.. g_RPCfunctions = { ... removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' }, removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' }, setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' }, --setElementDimension = true, setElementPosition = true, setElementInterior = true, ... } Thx 50p for helping me a bit... 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