Jump to content

Setting a .map to a dimension?


Karuzo

Recommended Posts

Hey Guys,

So i'm trying to put a map to the dimension 38 and tried that using the dimension argument in the meta.xml

like that:

"apartment_dm.map" dimension="38" /> 

But i just don't see the objects, and yes i am in the dimension 38.

Do i have to do something else to put the map to that dimension ?

Link to comment

Server side:

  
local Map_Data =  { } 
local MapName = "Your Map Name"  
local me_load = xmlLoadFile ( ":" . . MapName . ."/meta.xml" ) 
local m_map = xmlFindChild ( m_load ,"map", 0 ) 
        local m_mData = xmlNodeGetAttributes( m_map ) 
        if m_Data then  
        local ma_load = xmlLoadFile(":" . . MapName . . "/" . . m_mData["src"] ) 
for k, v in ipairs (  xmlNodeGetChildren( ma_load )  ) do 
-- Now loop and doop  
--- ....... Some code 
--- For Creating objects  
Map_Data [ #Map_Data + 1] = { "object",model, x, y, z, px,py,pz, LOD } -- that "object" is just to specify that its an object when you loop in i,v pairs then use ------ if v[1] == "object" then -- CREATE THE OBJECT IN CLIENT SIDE NOW 
end 
end 
  
  

For creating objects in another dimension then:

Client side:

  
-- Client side is better, you can send tables from server side for the the players in team 
local m_Objects = { } 
_createObject = createObject 
function createObject (model, x, y, z, px,py,pz, opt) 
    local px = px or 0     local py = py or 0   local pz = pz or 0  local opt = opt or false 
  
    local m_Cobject = _createObject(model, x, y, z, px,py,pz,opt) 
    if m_Cobject then 
        table.insert { m_Objects, m_Cobject } -- insert into a table so you can destroy it with loop when you want to stop the map 
        return  m_Cobject  
    end 
end 
  
local Map_Elements  = { } 
--------------------------------- when creating the objects in client side then 
for _,v in pairs ( Map_Data )  do 
if v[1] == "object" then 
local elem = _createObject (v[2], v[3],v[4],v[5],v[6],v[7],v[8],v[9]) -- replace the coordinates with the map coordinates  
Map_Elements [ #Map_Elements + 1 ] = elem   -- insert it into table so you can remove it with a loop later 
end 
     end 
  
------------------------- when removing them 
function RemoveElems () 
for k,v in pairs ( Map_Elements )  do 
if isElement (v) then 
destroyElement (v) 
else  
v = nil 
end 
end 
Map_Elements = { } 
end 
  
  

P.S I was first creating all objects in server side but after talking with Gallardo I decided to make them in client side because he advised me to keep the server side free and I know that its really complicated stuff but if you try to work on it then you'll understand how everything works ;)

Edited by Guest
Link to comment
You don't need to set dimensions unless you're sending things serverside. Send them via client and hide other players clientside by setting their dimensions to non-zero ones.

Yes, you're right. I totally forgot about that since the objects will be created for client so there's no need to send players to other dimensions.

I think i didn't explained it very well, i just have a map(TDM-Map), which i want to set to a different dimension.

That function doesn't work the way you want it. You'll need to create everything manually. Check the code again.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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