waleedrt Posted May 11, 2016 Share Posted May 11, 2016 can anyone tell me why is this does not work?? i can start it but it does not do any thing when i press lShift 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
BEN. Posted May 11, 2016 Share Posted May 11, 2016 addEventHandler ( string eventName, element attachedTo, function handlerFunction) addCommandHandler ( string commandName, function handlerFunction) Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 2016 addCommandHandler("bindme",fanFunction) Link to comment
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 so ..... i should replace addCommandHandler("bindme",fanFunction) with addEventHandler ( string eventName, element attachedTo, function handlerFunction) addCommandHandler ( string commandName, function handlerFunction) Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 2016 use command handler in your code try: addCommandHandler("bindme",fanFunction) in your code Link to comment
Walid Posted May 11, 2016 Share Posted May 11, 2016 function fanFunction() bindKey ("lshift","down",yourFunction) end addEvent("bindme",true) addEventHandler("bindme",root,fanFunction) function yourFunction() 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
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 @Walid n @BEN. it does not work Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 2016 your script on server side or client side? Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 2016 localPlayer can work only in client side Link to comment
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 so i have to change it from the meta right? Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 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
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 nope... i can open it without any problem but when i press shift nothing happens Link to comment
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 http://www49.zippyshare.com/v/ZcmwpAgC/file.html Link to comment
BEN. Posted May 11, 2016 Share Posted May 11, 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
waleedrt Posted May 11, 2016 Author Share Posted May 11, 2016 ye i worked thnx but can u tell me how to make it just for admins without using acl 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