Jump to content

Question createElement


WASSIm.

Recommended Posts

hi guys. have question about createElement.

i want make create gate in file map like this

    id="1" model="3276" posX="-1436.30005" posY="-971.59998" posZ="200.60001" rotX="0" rotY="0" rotZ="0" interior="0" dimension="0">>

i know i can make this with createElement but how fixed post ?

Link to comment
local gate = createElement ( "gate" ) 
setElementData ( gate, "posX", 0 ) 
setElementData ( gate, "posY", 0 ) 
setElementData ( gate, "posZ", 0 ) 
setElementData ( gate, "rotX", 0 ) 
setElementData ( gate, "rotY", 0 ) 
setElementData ( gate, "rotZ", 0 ) 
setElementData ( gate, "interior", 0 ) 
setElementData ( gate, "dimension", 0 ) 

Link to comment
local gate = createElement ( "gate" ) 
setElementData ( gate, "posX", 0 ) 
setElementData ( gate, "posY", 0 ) 
setElementData ( gate, "posZ", 0 ) 
setElementData ( gate, "rotX", 0 ) 
setElementData ( gate, "rotY", 0 ) 
setElementData ( gate, "rotZ", 0 ) 
setElementData ( gate, "interior", 0 ) 
setElementData ( gate, "dimension", 0 ) 

thank you :D

Link to comment

In case if you will ask about how to get the element data, loop it

-- It's just an example. 
local gObjects = { } 
local gGateID = 50 -- change it to the perfect gate ID. 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function( ) 
        for key, gates in ipairs ( getElementsByType( 'gate' ) ) do 
            if getElementData( gates, "posX" ) and getElementData( gates, "posY" ) and getElementData( gates, "posZ" ) then 
                gObjects[ key ] = createObject( gGateID, getElementData( gates, "posX" ), getElementData( gates, "posY" ), getElementData( gates, "posZ" ) ); 
            end 
        end 
    end 
); 

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