razvan2299 Posted August 28, 2014 Share Posted August 28, 2014 Hi! So I'd like to make a bind resource that whenever I press : Z-Uses command /seatbelt C-Uses command /cc X-Uses command /togwindow G-Uses /handbrake Any help? Link to comment
Mr_Moose Posted August 28, 2014 Share Posted August 28, 2014 Something like this maybe: function reloadGun ( player, command ) reloadPedWeapon ( player ) end function resourceStart( ) local players = getElementsByType ( "player" ) for k,v in ipairs(players) do bindKey ( v, "r", "down", reloadGun, "Reload" ) end end function playerJoin( ) bindKey ( source, "r", "down", reloadGun, "Reload" ) end addEventHandler( "onResourceStart", root, resourceStart ) addEventHandler( "onPlayerJoin", root, playerJoin ) This is used to bind a function which allow you to reload guns but it's easy to work with and modify for your needs, good luck. Link to comment
lcd12321 Posted August 28, 2014 Share Posted August 28, 2014 bindKey ( 'g', 'up', 'handbrake' ) on client-side or bindKey (thePlayer 'g', 'up', 'handbrake' ) on server-side Link to comment
razvan2299 Posted August 28, 2014 Author Share Posted August 28, 2014 Well, I see that you did for reload, I'd like you(if you can/know) to make one for /seatbelt, as an example. Thanks. Link to comment
Mr_Moose Posted August 28, 2014 Share Posted August 28, 2014 Sure, the bindKey function comes in two shapes, one accept functions and the other accept commands which also trigger a function at the end, so all you need to change is this part: bindKey ( source, "r", "down", reloadGun, "Reload" ) into this: bindKey ( source, "r", "down", "seatbelt", "Toggle seatbelt" ) 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