How to check if player did alt-tab (tabbed out of game)

hi
I want to know if there is any way to detect if player is not at game now ?
for example if player alt-tab and goes to desktop

1 Like
	if IsControlJustPressed(0, 19) && isControlJustPressed(0, 37) then

       else 

thank you for the answer but this solution not works because when player presses [Alt] then the focus goes out of the game and the [Tab] will not get detected

by the way even if this way would work still it would be not a safe way to detect

1 Like

hi
I already read this

but need to know a better way
also IsInPowerSavingMode not working if I alt-tab

I’m not trying to make a afk system
I’m just trying to find out if player is inside the game or not

I would be appreciate if you help me

And why are you trying to ‘find this out’? As that reply you’re referring to (and didn’t read, apparently) says, when asking for any functionality, you should at least say why you want it, as then an answer can be tailored to that specific use case.

(also, ‘an afk system’ and ‘inside the game or not’ can still be seen as synonymous!)

tnx for the answer

well I’m not trying to build an afk system
I just need detection for the anti cheat that I’m making

and I don’t know if there is any native function for doing that

How does ‘alt-tabbing’ in any way indicate ‘cheating’? Anyway, reasons like that are exactly why there is no ‘native function for doing that’.

no I’m not saying if someone alt-tab is a cheater, no !
the method I’m using for the detection is based by this function

GetNuiCursorPosition()

but the problem is even if player alt-tab the NUI cursor also will get changed inside the game

as an example you are on desktop page and moving your mouse so the NUI cursor position will also change inside the game

that’s why I need a way to know if player is tabbed out or not

can u help me ?

maybe try some js…?

Hi, the method you’re trying to create doesn’t require you to check if the player is off-screen. I think you want to create a method that will detect internal UI menus. Such a method will result in many false bans and you won’t be able to verify it because the menu is not rendered in the game. Many cheats have patched this in themselves, making it harder to detect in this way

2 Likes

You’re aware that the actual overlay/window you’re seeing when using such ‘software’ is not a NUI in any terms right?

It’s externally rendered either as a DirectX overlay or separate window (countless methods), so as long as you’re not having access to the DirectX rendering pipeline (you don’t) all those tries are worthless.

Maybe a better idea to invest your time in something else more ‘actionable’.

1 Like

Yes you are right about it, tnx for sharing the info

tnx for the answer and now I get it, as you said the software is not a NUI so I guess even if it was another game that would be the same case

it won’t work my friend I already tested everything at js