ChisleLP Posted January 31, 2018 Share Posted January 31, 2018 Hey... I currently a little new. Or I would say, I'm not anymore new. So it started 2 days MTA Scripting (I can before Lua/Java) so its feel for me really easy. but now I'm thinking about: Is it there a way to make co-drivers can control the cars? I couldn't find the Events/Function for it. Thanks. Link to comment
Moderators IIYAMA Posted January 31, 2018 Moderators Share Posted January 31, 2018 You can take over the controls of the driver. But the driver remains to be the syncer of the vehicle. Which means that the delay of the action depends on the driver and co-driver their internet speed. https://wiki.multitheftauto.com/wiki/SetControlState https://wiki.multitheftauto.com/wiki/BindKey (serverside) 1 Link to comment
ChisleLP Posted January 31, 2018 Author Share Posted January 31, 2018 Hmmm then would be bindkey this?: bindKey ( player, "W", "down", "accelerate") (btw tested, didnd't work) Link to comment
Zorgman Posted January 31, 2018 Share Posted January 31, 2018 (edited) function driverAccelerate (keyPresser, key, keyState) if key == "W" and getPedOccupiedVehicleSeat(keyPresser) and getPedOccupiedVehicleSeat(keyPresser) ~= 0 then local veh = getPedOccupiedVehicle(keyPresser) local driver = getVehicleController(veh) if driver then if keyState == "down" then setControlState (driver,"accelerate",true) else setControlState (driver,"accelerate",false) end else return end end end bindKey ( player, "W", "both", driverAccelerate) Untested Edited January 31, 2018 by Zorgman tweaked code 1 Link to comment
ChisleLP Posted January 31, 2018 Author Share Posted January 31, 2018 Thanks, it worked. Link to comment
Slim Posted February 1, 2018 Share Posted February 1, 2018 (edited) You should be looking into the better ways of detecting acceleration and the clients preferred key set, as for some players use different keys or controllers. It's somewhere in the wiki.MTA Wiki Edited February 1, 2018 by Justin|X5| Link to comment
Zorgman Posted February 2, 2018 Share Posted February 2, 2018 https://wiki.multitheftauto.com/wiki/Control_names Link to comment
ChisleLP Posted February 2, 2018 Author Share Posted February 2, 2018 Yeah i founded this both already. No clue why you're reply again if i marked the thread as "solved" 1 Link to comment
Moderators IIYAMA Posted February 2, 2018 Moderators Share Posted February 2, 2018 You can also bind controls. https://wiki.multitheftauto.com/wiki/Control_names Link to comment
ChisleLP Posted February 6, 2018 Author Share Posted February 6, 2018 why youre still reposting it. Didn't i set it to solved? ... Link to comment
Zorgman Posted February 6, 2018 Share Posted February 6, 2018 use the control names, bind them, hope this helps 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