Jump to content

[SOLVED] Block and Re-enable All Command Handlers


Recommended Posts

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?

:fadein:

Edited by Guest
Link to comment

  
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
  
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

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 :shock:

Any more ideas??

Link to comment

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!

:fadein:

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...