Jump to content

scripting to editor mode


Recommended Posts

i tried to scripting to edior mode , select object and create another one .

code :

  
function start(player) 
     outputChatBox("welcome to neri tools" ) 
end 
function createandmove(player) 
     if selectedElement ~= nil then 
     createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) 
     newobject = createObject( model, x, y, z , 90, 0, 0 )  
     end 
end 
function click(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) 
        if ( clickedElement ) then 
            selectedElement = clickedElement 
            model = getElementModel(selectedElement) 
            x , y , z = getElementPosition(selectedElement) 
            outputChatBox(tostring(x) .. " ".. tostring(y) .. " ".. tostring(z) .. " ".. tostring(model)) 
            else 
            selectedElement = nil 
        end 
end 
addEventHandler( "onClientResourceStart",getRootElement( ) , start ) 
addCommandHandler("create",createandmove) 
addEventHandler ( "onClientClick", getRootElement(), click ) 
  

the select object is work , but its not create the object with no errors , please help me with that , and if you have better way to select object go for it. thanks :D

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