Jump to content

Help Arena's?


Recommended Posts

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
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

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

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

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...