FlyingSpoon Posted April 27, 2015 Share Posted April 27, 2015 I am making a small gamemode, working with a friend's server. I am trying to create Arena's, I got buttons and everything set, but where will I start to create these arena's? I don't understand, me and my friend are confused. Link to comment
WhoAmI Posted April 27, 2015 Share Posted April 27, 2015 What do you mean by area? Radararea? Or some part of map? If so, use colshape. Link to comment
FlyingSpoon Posted April 27, 2015 Author Share Posted April 27, 2015 No, no Like multi gamemode. Different arena's. I got to this part with my friend, but now, we don't know how to actually add in or create the arena's. Link to comment
MTA Team botder Posted April 27, 2015 MTA Team Share Posted April 27, 2015 setElementDimension 'Dimensions' are seperated GTA worlds. If you are in dimension 1 (e. g. Deathmatch Arena) you can't see objects/players/vehicles/.. from other dimensions. Link to comment
FlyingSpoon Posted April 27, 2015 Author Share Posted April 27, 2015 How would I load maps separately though? Link to comment
Derpy Posted April 27, 2015 Share Posted April 27, 2015 read map data from .map file(with xml functions), create objects,pickups,vehicles etc and set them to the dimension in which arena they are created Link to comment
FlyingSpoon Posted April 27, 2015 Author Share Posted April 27, 2015 Any examples At this point I am confused Link to comment
Addlibs Posted April 27, 2015 Share Posted April 27, 2015 local mapFileNode = xmlLoadFile() for i, v in ipairs( xmlNodeGetChildren(mapFileNode) ) do if xmlNodeGetName(v) == "object" then local model = xmlNodeGetAttribute(v, "model") --etc createObject(model, ...) end end Link to comment
FlyingSpoon Posted April 28, 2015 Author Share Posted April 28, 2015 So, what does this code do exactly? Link to comment
ALw7sH Posted April 28, 2015 Share Posted April 28, 2015 For dm,dd,shooter,fun and training You have to make cutsom map loader(inculd object loader which is easy and scripts loader which is little bit more hard) And the other things not really hard like map time etc... Also you can check the race gamemode for that And for the freeroam there's nothing hard just set the player on any dimension and spawn him Link to comment
Addlibs Posted April 28, 2015 Share Posted April 28, 2015 arenaObjects = {} function loadMapIntoArena(mapresourcename, mapfilename, arenaID) if arenaObjects[arenaID] then for k, v in ipairs(arenaObjects[arenaID]) do destroyElement(v) end end arenaObjects[arenaID] = {} local mapFileNode = xmlLoadFile(":".. mapresourcename.."/".. mapfilename..".map") if mapFileNode then for i, v in ipairs( xmlNodeGetChildren(mapFileNode) ) do if xmlNodeGetName(v) == "object" then local model = xmlNodeGetAttribute(v, "model") --etc local x, y, z = xmlNodeGetAttribute(v, "posX"), xmlNodeGetAttribute(v, "posY"), xmlNodeGetAttribute(v, "posZ") local rx, ry, rz = xmlNodeGetAttribute(v, "rotX"), xmlNodeGetAttribute(v, "rotY"), xmlNodeGetAttribute(v, "rotZ") local obj = createObject(model, x, y, z, rx, ry, rz) setElementDimension(obj, arenaID) table.insert(arenaObjects[arenaID], obj) end end return true end return false end This code will load map objects for a specific arena (dimension) ID, and delete previous objects for that arena where applicable. Syntax: bool loadMapIntoArena ( string mapResourceName, string mapFileName, int Arena/Dimension ID) mapResourceName — Resource name where the map file is located mapFileName — File name (excluding the ".map" extension) Arena/Dimension ID — Self explanatory This script will require Admin permissions, because it accesses files on other resources. Link to comment
FlyingSpoon Posted April 28, 2015 Author Share Posted April 28, 2015 So is the code all client side? arenaObjects = {} function loadMapIntoArena(mapresourcename, mapfilename, arenaID) if arenaObjects[arenaID] then for k, v in ipairs(arenaObjects[arenaID]) do destroyElement(v) end end arenaObjects[arenaID] = {} local mapFileNode = xmlLoadFile(":".. mapresourcename.."/".. mapfilename..".map") if mapFileNode then for i, v in ipairs( xmlNodeGetChildren(mapFileNode) ) do if xmlNodeGetName(v) == "object" then local model = xmlNodeGetAttribute(v, "model") --etc local x, y, z = xmlNodeGetAttribute(v, "posX"), xmlNodeGetAttribute(v, "posY"), xmlNodeGetAttribute(v, "posZ") local rx, ry, rz = xmlNodeGetAttribute(v, "rotX"), xmlNodeGetAttribute(v, "rotY"), xmlNodeGetAttribute(v, "rotZ") local obj = createObject(model, x, y, z, rx, ry, rz) setElementDimension(obj, arenaID) table.insert(arenaObjects[arenaID], obj) end end return true end return false end function noobClicks() if source == btnDeath then setElementDimension ( source, 1 ) triggerEvent ( "hideLoginWindow", getRootElement() ) removeEventHandler( "onClientRender", root, renderLobby ) loadMapIntoArena ( "$dm-arena1", "dm-arena1.map", 1) end end addEventHandler("onClientGUIClick", getRootElement(), noobClicks) Link to comment
ALw7sH Posted April 28, 2015 Share Posted April 28, 2015 dont create the objects on server side load them into table and when player joined the arena get the table from server side and create the objects on client side and also when map started load them into table and send them to all arena players client side to create them 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