Jump to content

help make object


Recommended Posts

Posted

Hi, for that you will need the following functions:

bindKey

createObject

attachElements (maybe?) 

and you have to do it in server side to assure others will see it!

Good luck, and if you need help we’re here!

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

Posted
15 hours ago, Tekken said:

Hi, for that you will need the following functions:

bindKey

createObject

attachElements (maybe?) 

and you have to do it in server side to assure others will see it!

Good luck, and if you need help we’re here!

i mean get forward position for player how ?

Posted

There are a few threads on the forum with the same subject.
Don't be shy to use the search feature! ?

Here is what I found which might be the answer for you (not written by me):

function getPositionInfrontOfElement ( element , meters ) 
    if not element or not isElement ( element ) then 
        return false 
    end 
    if not meters then 
        meters = 3 
    end 
    local posX , posY , posZ = getElementPosition ( element ) 
    local _ , _ , rotation = getElementRotation ( element ) 
    posX = posX - math.sin ( math.rad ( rotation ) ) * meters 
    posY = posY + math.cos ( math.rad ( rotation ) ) * meters 
    return posX , posY , posZ 
end 

 

Posted
2 hours ago, SpecT said:

There are a few threads on the forum with the same subject.
Don't be shy to use the search feature! ?

Here is what I found which might be the answer for you (not written by me):


function getPositionInfrontOfElement ( element , meters ) 
    if not element or not isElement ( element ) then 
        return false 
    end 
    if not meters then 
        meters = 3 
    end 
    local posX , posY , posZ = getElementPosition ( element ) 
    local _ , _ , rotation = getElementRotation ( element ) 
    posX = posX - math.sin ( math.rad ( rotation ) ) * meters 
    posY = posY + math.cos ( math.rad ( rotation ) ) * meters 
    return posX , posY , posZ 
end 

 

i have seen all topics but i don't know what argument to setElementPosition Use
in your Code use posX,posY,posZ Right ?

Posted
function getPositionInfrontOfElement ( element , meters ) 
    if not element or not isElement ( element ) then 
        return false 
    end 
    if not meters then 
        meters = 3 
    end 
    local posX , posY , posZ = getElementPosition ( element ) 
    local _ , _ , rotation = getElementRotation ( element ) 
    posX = posX - math.sin ( math.rad ( rotation ) ) * meters 
    posY = posY + math.cos ( math.rad ( rotation ) ) * meters 
    return posX , posY , posZ 
end

Use it like that:

local fx, fy, fz = getPositionInfrontOfElement(player, 5);
-- get the x,y,z positions 5 meters in front of player!
createObject(OBJECTID, fx, fy, fz);

Remember getPositionInfrontOfElement is a useful function so you will have to paste the code above in order to work!

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

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