Axel Posted March 1, 2012 Posted March 1, 2012 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?
Kenix Posted March 1, 2012 Posted March 1, 2012 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 )
Axel Posted March 1, 2012 Author Posted March 1, 2012 I mean.. Like u press SHIFT and jump, i want to make it jump more than that with /parkour command
Kenix Posted March 1, 2012 Posted March 1, 2012 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.
Axel Posted March 1, 2012 Author Posted March 1, 2012 Only when the player uses the command it should jump, is it possible?
Axel Posted March 1, 2012 Author Posted March 1, 2012 Well anyone can jump higher.. What i mean is only if u use the command , now without using it you can jump higher..
Kenix Posted March 1, 2012 Posted March 1, 2012 Not understand you. What you mean? Explain better please.
Agon Posted March 1, 2012 Posted March 1, 2012 I think he means that: setWorldSpecialPropertyEnabled(extrajump, true) like kangaroo in san andreas, right?
12p Posted March 1, 2012 Posted March 1, 2012 OFF-TOPIC: Lol it's the OP birthday. Happy birthday Axel.
Axel Posted March 1, 2012 Author Posted March 1, 2012 Off. Thanks On. Well i tried it and it returns a nil value..
Axel Posted March 1, 2012 Author Posted March 1, 2012 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 )
12p Posted March 1, 2012 Posted March 1, 2012 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).
Axel Posted March 3, 2012 Author Posted March 3, 2012 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)
Castillo Posted March 3, 2012 Posted March 3, 2012 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.
Castillo Posted March 3, 2012 Posted March 3, 2012 What exactly doesn't work? P.S: Copy server side, I changed applyAnimation ( to reset ) to: removeAnimation.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now