waleedrt Posted May 11, 2016 Share Posted May 11, 2016 can anyone tell me why is this does not work?? function fanFunction() bindKey ( "lshift","down", function () local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end ) end addEventHandler("bindme",fanFunction) Link to comment
MACIEKW89 Posted May 11, 2016 Share Posted May 11, 2016 Hi, Try with that : function fanFunction() bindKey ( "lshift","down", function () local vehicle = getPedOccupiedVehicle(localPlayer) local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end) end addEventHandler("bindme",fanFunction) Link to comment
BEN. Posted May 12, 2016 Share Posted May 12, 2016 bindKey("lshift","down", function() if isPedInVehicle (localPlayer) then local vehicle = getPedOccupiedVehicle (localPlayer) local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end end) Link to comment
Urban_West Posted May 13, 2016 Share Posted May 13, 2016 What are you trying to do? 0.5 in z won't change much (that's up and down btw), plus that getElementVelocity won't always get the exact speed of the element Link to comment
waleedrt Posted May 13, 2016 Author Share Posted May 13, 2016 @BEN i want it to be a command @MACIEKW89 not working @Urban_West ye i know , i have try it and it "change much" Link to comment
Feher Posted May 13, 2016 Share Posted May 13, 2016 Hey, use addCommandHandler instead of addEventHandler Link to comment
waleedrt Posted May 13, 2016 Author Share Posted May 13, 2016 function fanFunction() bindKey ( "lshift","down", function () local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end ) end addCommandHandler("bindme",fanFunction) still not working Link to comment
Feher Posted May 13, 2016 Share Posted May 13, 2016 Type /bindme first after you can use left shift button function fanFunction ( player) bindKey ( player, "lshift", "down", function (player) local vehicle = getPedOccupiedVehicle(player) local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end ) end addCommandHandler ( "bindme", fanFunction ) Link to comment
Gravestone Posted May 14, 2016 Share Posted May 14, 2016 Try using event handler instead of command. function fanFunction ( player) local vehicle = getPedOccupiedVehicle(player) local sx,sy,sz = getElementVelocity ( vehicle ) setElementVelocity( vehicle ,sx, sy, sz+0.5 ) end addEventHandler("onClientResourceStart", getRootElement(), fanFunction) bindKey ( player, "lshift", "down", fanFunction) Link to comment
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