Jump to content

Hide Player Map


Kayl

Recommended Posts

Hello,

So first of all I am not talking about the HUD radar in the lower left corner.

I am talking about the full size radar map that you can toggle using the "radar" command, bound to the F11 key by default.

I am looking for a way to hide this radar map for specific players.

I know there is a server side function forcePlayerMap.

However it seems to force or stop forcing the display of the map. It can not force the radar map "off".

On the client side there are isPlayerMapForced and isPlayerMapVisible, only getters, no setters.

I tried:

toggleControl("radar",false"): it only affects the availability of the "radar" command, it doesn't change the current state

setControlState("radar",true): when isPlayerMapVisible() return true to try to hide it, doesn't work

executeCommandHandler("radar"): this returns false so I guess it's not possible. If it was that easy I guess the forcePlayerMap function wouldn't exist

I'm out of ideas. Is there any undocumented function that would to the job or am I misusing one of the aforementioned techniques?

Edited by Guest
Link to comment

I'm sorry but in my initial post I started with:

So first of all I am not talking about the HUD radar in the lower left corner.

And on the page you provided the only radar mentioned that can be disabled is the bottom left one. So I guess showPlayerHudComponent is not what I'm after.

Am i missing an item in showPlayerHudComponent ?

Link to comment
  • 4 weeks later...

I take the liberty to request fresh ideas again for my problem since it still isn't solve.

Once again I'm not talking about the HUD radar but the map that can be forced on with forcePlayerMap but can not be forced off (at least I don't know how, hence the topic).

Link to comment

Well you got it right.

I want to disable the F11 functionality.

I can disable the key to avoid the player to show it. But I can not force it off when it is already on, since forcePlayerMap( player, false ) only seem to "stop forcing" but doesn't remove the map if it is shown.

Link to comment
Well you got it right.

I want to disable the F11 functionality.

I can disable the key to avoid the player to show it. But I can not force it off when it is already on, since forcePlayerMap( player, false ) only seem to "stop forcing" but doesn't remove the map if it is shown.

toggleControl("radar", false)

Link to comment
Well you got it right.

I want to disable the F11 functionality.

I can disable the key to avoid the player to show it. But I can not force it off when it is already on, since forcePlayerMap( player, false ) only seem to "stop forcing" but doesn't remove the map if it is shown.

toggleControl("radar", false)

I tried:

toggleControl("radar",false"): it only affects the availability of the "radar" command, it doesn't change the current state

Link to comment

Force the radar on, then setControlState("radar", true) which should hide it again. From there, you can proceed to disable the control with toggleControl.

You might want to setControlState("radar", false) after a short delay so it doesn't "stay pressed", although it might not matter...

Edit: I should mention I have no freaking idea whether this'll actually work, but it's worth a try.

Link to comment

Thanks for the ideas.

Below you'll find the code of what I have tried so far.

+ forcePlayerMap(player,false) seems to hide the map only if it was shown due to a previous forcePlayerMap(player,true), it doesn't work if it was shown with F11

+ the "radar" command works when typed in F8 but I can't seem to make it work from code

+ setting the control state of the radar "control" doesn't seem to work

Server test:

function testserver(player,cmd,id)
local test_id = tonumber(id)
 
if test_id == 1 then
--show & hide > works
forcePlayerMap(player,true)
setTimer(forcePlayerMap,5000,1,player,false)
elseif test_id == 2 then
--try to see if the "radar" input can show the map
setControlState(player,"radar",true)
setTimer(setControlState,1000,1,player,"radar",false)
setTimer(forcePlayerMap,5000,1,player,false)	
elseif test_id == 3 then
--try to see if the "radar" command can be called 
executeCommandHandler("radar",player)
setTimer(forcePlayerMap,1000,1,player,false)
elseif test_id == 4 then
--gives 5 seconds for player to show map and then try to hide it
setTimer(forcePlayerMap,5000,1,player,false)
elseif test_id == 5 then
--gives 5 seconds for player to show map and then try to hide it with input
setTimer(setControlState,5000,1,player,"radar",true)
setTimer(setControlState,6000,1,player,"radar",false)
elseif test_id == 6 then
--gives 5 seconds for player to show map and then try to hide it with force on & off
setTimer(forcePlayerMap,5000,1,player,true)
setTimer(forcePlayerMap,5500,1,player,false)
else
outputChatBox("No test executed")
end
end
addCommandHandler("stest",testserver)

Client test:

function testclient(cmd,id)
local test_id = tonumber(id)
 
if test_id == 1 then
setControlState("radar",true)
setTimer(setControlState,1000,1,"radar",false)
elseif test_id == 2 then
executeCommandHandler("radar")
elseif test_id == 3 then
--gives 5 seconds to enable map and try to hide it with input
setTimer(setControlState,5000,1,"radar",true)
setTimer(setControlState,5500,1,"radar",false)
else
outputChatBox("No test executed")
end
end
addCommandHandler("ctest",testclient)

Link to comment

Thanks for the ideas.

Below you'll find the code of what I have tried so far.

+ forcePlayerMap(player,false) seems to hide the map only if it was shown due to a previous forcePlayerMap(player,true), it doesn't work if it was shown with F11

+ the "radar" command works when typed in F8 but I can't seem to make it work from code

+ setting the control state of the radar "control" doesn't seem to work

Server test:

function testserver(player,cmd,id)	local test_id = tonumber(id) 	if test_id == 1 then		--show & hide > works		forcePlayerMap(player,true)		setTimer(forcePlayerMap,5000,1,player,false)	elseif test_id == 2 then		--try to see if the "radar" input can show the map		setControlState(player,"radar",true)		setTimer(setControlState,1000,1,player,"radar",false)		setTimer(forcePlayerMap,5000,1,player,false)		elseif test_id == 3 then		--try to see if the "radar" command can be called 		executeCommandHandler("radar",player)		setTimer(forcePlayerMap,1000,1,player,false)	elseif test_id == 4 then		--gives 5 seconds for player to show map and then try to hide it		setTimer(forcePlayerMap,5000,1,player,false)	elseif test_id == 5 then		--gives 5 seconds for player to show map and then try to hide it with input		setTimer(setControlState,5000,1,player,"radar",true)		setTimer(setControlState,6000,1,player,"radar",false)	elseif test_id == 6 then		--gives 5 seconds for player to show map and then try to hide it with force on & off		setTimer(forcePlayerMap,5000,1,player,true)		setTimer(forcePlayerMap,5500,1,player,false)	else		outputChatBox("No test executed")	endendaddCommandHandler("stest",testserver)

Client test:

function testclient(cmd,id)	local test_id = tonumber(id) 	if test_id == 1 then		setControlState("radar",true)		setTimer(setControlState,1000,1,"radar",false)	elseif test_id == 2 then		executeCommandHandler("radar")	elseif test_id == 3 then		--gives 5 seconds to enable map and try to hide it with input		setTimer(setControlState,5000,1,"radar",true)		setTimer(setControlState,5500,1,"radar",false)	else		outputChatBox("No test executed")	endendaddCommandHandler("ctest",testclient)

Link to comment
How about scrapping forcePlayerMap and just make it setPlayerMapShowing? Perhaps some compatibility issues but sounds a lot more logical.

That's even better. Setting the actual "showing" state like that makes more sense, and you could always replace this old functionality with toggleControl. There is a difference, but you could still do the same kind of things.

Link to comment
How about scrapping forcePlayerMap and just make it setPlayerMapShowing? Perhaps some compatibility issues but sounds a lot more logical.

That's even better. Setting the actual "showing" state like that makes more sense, and you could always replace this old functionality with toggleControl. There is a difference, but you could still do the same kind of things.

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