Jump to content

Using "radar" as command name does not work


johny46

Recommended Posts

Posted

Hi. I want to execute some function whenever a player opens his map. According to the "MTA hard-coded commands" section of Control names i should be able to use "radar" as a command. Then why this code:

addCommandHandler("radar", function() 
  outputDebugString("Command handler executed!") 
end) 

does not work? No debug string is outputted no matter if I press the F11 key or actually type "radar" on the console, but the map is shown in both situations.

Posted

As far as I remember, you can't have custom command handlers for hard-coded commands.

Posted

Then how can I execute some code whenever a player opens his map without having to check whether isPlayerMapVisible "onClientRender"?

Posted

Then how can i know when player changes his bindings? Afaik there's no event for that so i'd have to run 'getKeyBoundToCommand' onClientRender :(

Posted

Do people change their keys during playing? Well, I don't, especially the key for radar. If you really need that then you can use a timer instead of onClientRender.

Posted

It basically is meant to hide all player blips whenever they open their map and show them again when map is closed, so it has to be fast. I think i'll make a timer to call 'getKeyBoundToCommand' every second, because I don't think it's possible to save settings, press the OK button, then press Esc and then open the map in less than one second :P thanks.

  • MTA Team
Posted

How does customblips do this?

Taking a long look at the code it looks like you will have to use a render event, but to make things more streamlined you could just use customblips.

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