-Doc- Posted December 18, 2015 Share Posted December 18, 2015 Is something wrong there? function isPlayerMoving(player) return (not isPedInVehicle(player) and (getPedControlState(player, "forwards") or getPedControlState(player, "backwards") or getPedControlState(player, "aim_weapon") or getPedControlState(player, "left") or getPedControlState(player, "right") or getPedControlState(player, "accelerate") or getPedControlState(player, "brake_reverse") or getPedControlState(player, "enter_exit") or getPedControlState(player, "enter_passenger"))) end Link to comment
ALw7sH Posted December 18, 2015 Share Posted December 18, 2015 Yes you have to do (not isPedInVehicle(player) and getPedControlState(player, "forwards") == true) and true or (not isPedInVehicle(player) and getPedControlState(player, "backwards") == true) and true etc... Just use that method local controls = {"forwards","backwards","aim_weapon","left","right","accelerate","brake_reverse","enter_exit","enter_passenger"} function isPlayerMoving(player) if not isPedInVehicle(player) then for k,v in ipairs(controls) do if getPedControlState(player, v) then return true end end end return false end Link to comment
-Doc- Posted December 18, 2015 Author Share Posted December 18, 2015 Look in pm i sended my script. Link to comment
Addlibs Posted December 19, 2015 Share Posted December 19, 2015 you have to do(not isPedInVehicle(player) and getPedControlState(player, "forwards") == true) and true or (not isPedInVehicle(player) and getPedControlState(player, "backwards") == true) and true etc... That's pretty incorrect. You don't have to do that. Link to comment
ALw7sH Posted December 19, 2015 Share Posted December 19, 2015 you have to do(not isPedInVehicle(player) and getPedControlState(player, "forwards") == true) and true or (not isPedInVehicle(player) and getPedControlState(player, "backwards") == true) and true etc... That's pretty incorrect. You don't have to do that. There's nothing called incorrect, it called a proper way ... Link to comment
Addlibs Posted December 20, 2015 Share Posted December 20, 2015 1) By 'incorrect', I did not mean 'incorrect way' I mean that your statement was incorrect - you do not have to add 'and true' 2) The proper way is the most efficient way — don't add unnecessary bytes by adding redundant parts to a script. That is called being inefficient. Link to comment
Moderators IIYAMA Posted December 20, 2015 Moderators Share Posted December 20, 2015 The function getPedTask gives more accurate results in what the player is doing and will be more 'efficiënt'... https://wiki.multitheftauto.com/wiki/GetPedTask 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