Jump to content

Creating an Object


Karuzo

Recommended Posts

Hey Guys,

I wanted to create a small object-builder, but i just dunno why i can't see the created object.

It outputs "object" but i don't see one.

Hope you can help me.

    local opened 
    function open() 
        opened = not opened 
            if opened == true then 
                addEventHandler("onClientRender", root, GetCursor) 
                showCursor(true) 
            else 
                showCursor(false) 
                removeEventHandler("onClientRender", root, GetCursor) 
            end 
    end 
    bindKey("m","down",open) 
     
    local worldx,worldy,worldz 
    function GetCursor() 
        if isCursorShowing() then 
            posx, posy, worldx, worldy, worldz = getCursorPosition() 
            local obj = createObject(17950,worldx, worldy, worldz+5) 
            if obj then  
                outputChatBox("object") 
            end 
        end 
    end 
  

Link to comment
Hey Guys,

I wanted to create a small object-builder, but i just dunno why i can't see the created object.

It outputs "object" but i don't see one.

Hope you can help me.

    local opened 
    function open() 
        opened = not opened 
            if opened == true then 
                addEventHandler("onClientRender", root, GetCursor) 
                showCursor(true) 
            else 
                showCursor(false) 
                removeEventHandler("onClientRender", root, GetCursor) 
            end 
    end 
    bindKey("m","down",open) 
     
    local worldx,worldy,worldz 
    function GetCursor() 
        if isCursorShowing() then 
            posx, posy, worldx, worldy, worldz = getCursorPosition() 
            local obj = createObject(17950,worldx, worldy, worldz+5) 
            if obj then  
                outputChatBox("object") 
            end 
        end 
    end 
  

I tried your code, rewrote your code, tried it again and I found out that the 3th, 4th and 5th coordinates are totally ignoring the floor. If you output the actual numbers it will give you a position that's quite far away. not only the height, but also the X and Y are wrong.

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