Jump to content

[Help]Sitting in a chair


OutPut

Recommended Posts

  • MTA Team
Posted

The closest I can find on the community page is this: https://community.multitheftauto.com/index.php?p=gallery&s=show&pic=7023

You should be able to find out how he got the players to sit in the wheelchair by looking at the code.

 

Otherwise to create your own system, you're going to need the following:

setPedAnimation, (set the player animation, to be sitting down)

getElementPoisiton (find out the position of the chair object)

setElementPosition (set the player position, to the same position as the chair, you might need to offset player position slightly to make it look better)

setElementFrozen (when the player is sitting, set them frozen, when not, unfreeze them)

  • 4 weeks later...
Posted

local couch1 = createObject(2290, -663, 947.29998779297, 11.5, 0, 0, 90)


function elementClicked( theButton, theState, thePlayer )
    if ( theButton ) == "left" then
        setElementPosition(thePlayer, -662.9, 948.39611816406, 12.484375)
        setElementRotation(thePlayer, 0, 0, 270)
        setPedAnimation( thePlayer, "food", "ff_sit_look", -1, false)
    else
        setPedAnimation( thePlayer )
    end
end


addEventHandler( "onElementClicked", couch1, elementClicked )

I know this post is old but i made this as an example for anyone who stumbles upon this post.
 

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