djaa2807 Posted July 8, 2012 Share Posted July 8, 2012 (edited) Is there a way to block all command handlers for a particular client for both serverside and clientside scripts and also re-enable them at once ? And this excludes the native MTA hardcoded commands. What i'm trying to achieve is to make a simple race script on a freeroam server using markers where the client must not be able to gain access to freeroam commands like pressing f1 to open the freeroam menu or type /repair to repair vehicle.. Anyone ever tried making something like this before? Edited July 9, 2012 by Guest Link to comment
Guest Guest4401 Posted July 8, 2012 Share Posted July 8, 2012 https://wiki.multitheftauto.com/wiki/OnP ... cel_effect Link to comment
djaa2807 Posted July 8, 2012 Author Share Posted July 8, 2012 function disable_freeroam_commands( ) cancelEvent() end function joinvrace( playerSource ) addEventHandler("onPlayerCommand", playerSource, disable_freeroam_commands) end addCommandHandler ( "joinvrace", joinvrace ) So yeah, i tried it and it doesnt disable the F1 freeroam menu.. Anyone else got some more ideas on how to disable freeroam commands and binds? I typed /joinvrace in chat and its loaded! How i know? well some key binds like 'p' for admin panel dont work! but F1 freeroam menu still works! Link to comment
50p Posted July 8, 2012 Share Posted July 8, 2012 djaa2807 said: function disable_freeroam_commands( ) cancelEvent() end function joinvrace( playerSource ) addEventHandler("onPlayerCommand", playerSource, disable_freeroam_commands) end addCommandHandler ( "joinvrace", joinvrace ) So yeah, i tried it and it doesnt disable the F1 freeroam menu.. Anyone else got some more ideas on how to disable freeroam commands and binds? I typed /joinvrace in chat and its loaded! How i know? well some key binds like 'p' for admin panel dont work! but F1 freeroam menu still works! The reason why admin panel doesn't work it's because the key is bound to a command. F1 panel in freeroam is not disabled because it's bound to a function (you don't disable functions, you disable commands). If you want to disable F1 from freeroam then you'll have to use: unbindKey( player, "f1" ); I haven't tried this and I don't know if this will unbind functions bound to a key in a different resource but it should. Link to comment
djaa2807 Posted July 9, 2012 Author Share Posted July 9, 2012 unbindKey( player, "f1" ) don't work! when i type "unbind f1" even in mta client console: * Failed to remove binds from key 'f1' and when i type "binds" in mta client console the F1 key bind isnt even there.. Its like the F1 key is a forbidden and sacred key or something in MTA Any more ideas?? Link to comment
djaa2807 Posted July 9, 2012 Author Share Posted July 9, 2012 Issue solved! It seems the only way to make this thing work was to modify the freeroam addon itself So i modified it to remove the function binds from in there using event triggers and works fine now. Thanks anyway people for your replies! 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