Jump to content

Parkour jump


Axel

Recommended Posts

I'm trying to make a parkour command to jump more than normal, but idk how to make the jump bigger..

function parkour(thePlayer) 
    local logged = getElementData(thePlayer, "loggedin") 
     
    if (logged==1) then 
        --Here , I was thinking about getControlState but.. 
    end 
end 
addCommandHandler ( "parkour", parkour, false, false ) 

And also i have a question, how can i make 2 animations play in a row?

Link to comment

Server

function parkour( uPlayer ) 
    local logged = getElementData( uPlayer, 'loggedin' ) 
     
    if logged == 1 then 
        local x,y,z = getElementVelocity( uPlayer ) 
        setElementVelocity( uPlayer, x, y, 0.5 ) -- change value where 0.5 ( how you want ) 
    end 
end 
addCommandHandler ( 'parkour', parkour, false, false ) 

Link to comment
function parkour( uPlayer ) 
    local logged = getElementData( uPlayer, 'loggedin' ) 
     
    if logged == 1 then 
        local x,y,z = getElementVelocity( uPlayer ) 
        setElementVelocity( uPlayer, x, y, 0.5 ) -- change value where 0.5 ( how you want ) 
    end 
end 
addCommandHandler ( 'parkour', parkour, false, false ) 
  
addEventHandler( 'onPlayerJoin', root,  
    function( ) 
        bindKey( source,'lshift', 'down', parkour ) 
    end 
)    
  
addEventHandler( 'onResourceStart', resourceRoot, 
    function( ) 
        for _,v in pairs( getElementsByType 'player' ) do 
            bindKey( v,'lshift','down',parkour ) 
        end 
    end 
)    

Key left shift.

Link to comment

I tested in the first one..

function parkourAnimation(thePlayer, cmd, arg) 
    local logged = getElementData(thePlayer, "loggedin") 
  
    if (logged==1) then 
        setWorldSpecialPropertyEnabled("extrajump", true) 
    end 
end 
addCommandHandler ( "parkour", parkourAnimation, false, false ) 

Link to comment

It can only work in client-side. Also,

function parkourAnimation( ) 
    if getElementData( "loggedin" ) == 1 then 
        setWorldSpecialPropertyEnabled( "extrajump", true ) 
    end 
end 
addCommandHandler( "parkour", parkourAnimation, false ) 

Make sure when you use set the "loggedin" element data, you are setting "synchronize" to true (reference, check forth argument).

Link to comment

Now i want to make like.. when u write something on the chatbox it starts an animation, and when u send it it stops

function chating(message, messageType) 
  
      if messageType == 0 then 
        exports.global:applyAnimation( getRootElement(), "SWIM", "Swim_Glide", 2000, false, false, false) 
        end 
end 
addEventHandler ( "onPlayerChat", getRootElement(),chating) 

Link to comment

Well, the onPlayerChat is triggered when someone says something on chat, but not when you just press 'enter' without saying anything, so you need to use this:

-- client side:

addEventHandler("onClientKey",root, 
    function (key, state) 
        if (key == "t" and state) then 
            triggerServerEvent("setAnimation",localPlayer,true) 
        elseif (key == "enter" and state) then 
            triggerServerEvent("setAnimation",localPlayer,false) 
        end 
    end 
) 

-- server side:

addEvent("setAnimation",true) 
addEventHandler("setAnimation",root, 
    function (state) 
        if (state) then 
            exports.global:applyAnimation( source, "SWIM", "Swim_Glide", 2000, false, false, false) 
        else 
            exports.global:removeAnimation( source ) 
        end 
    end 
) 

I tested it with setPedAnimation function, I hope applyAnimation works the same way.

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