Prevent Players from leaving the game

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

Spiky
Newcomer
Posts: 5
Joined: July 2nd, 2007, 5:51 pm

Prevent Players from leaving the game

Post by Spiky »

Hey guys. What do I need to code in order to disable the players from pressing Alt F4 and getting the "Confirm your exit" and exitting the game?
User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Re: Prevent Players from leaving the game

Post by Ozzapoo »

You cant...
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
User avatar
Bartimaeus
Tyrannical Drama Queen
Posts: 4430
Joined: November 19th, 2007, 5:05 am
Been thanked: 2 times

Re: Prevent Players from leaving the game

Post by Bartimaeus »

Ozzapoo wrote:You cant...
Er, you can't? Didn't Xantan make something that made it so you couldn't leave?
User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Re: Prevent Players from leaving the game

Post by Ozzapoo »

Oh yeah lol. I just asked him. Well there's no smart way of doing it....

You can just do something like this:

Code: Select all

function EveryFewMilliseconds takes nothing returns nothing
local integer i=0
loop
exitwhen i>11
if Player(i)==GetLocaPlayer()then
call ForceUICancel()
endif
set i=i+1
endloop
endfunction
That basically makes all players press the ESC button every few milliseconds... And so as soon as a menu pops up it closes. But the problem with that, is that it will also cancel target abilities. For example, if I clicked on flame strike and then wanted to target it, I couldn't, because the circle would have been cancelled as soon as you pressed the button. So basically, that's the only way to stop people from leaving, but, ofcourse, it has its consequences.
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
Durchdringen
Honorary wc3edit.net Traitor
Posts: 468
Joined: December 10th, 2007, 10:50 pm
Title: The Professional
Location: USA

Re: Prevent Players from leaving the game

Post by Durchdringen »

Maybe theres a way the game can directly tell if the player is using the user interface or not. If so this is how it should run.

(1) We have a waiting trigger that waits for a player to enter the User Interface.
(2) When that trigger checks true, it sets off a kick out trigger that kicks the player out of the interface.
(3) .5 sec later we turn both triggers off so that everything is reset.

I'm sure Xantan would know how to do it. He always disabled me from getting locked in the game and getting goatse'd, but the rest were screwed lol. So we already know theres a reverse, but making the game sensing people trying to get out is a different story.
Do you support Durchdringen? If so, add the spoiler to your sig. Durch cares for you, so show your support for Durch!
Spoiler:
(broken image) Thanks for the support!
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Prevent Players from leaving the game

Post by Aero »

Lol...you could optimize that code to...

Code: Select all

function EveryFewMilliseconds takes nothing returns nothing
call ForceUICancel()
endfunction
User avatar
Ozzapoo
The Flying Cow!
Posts: 2196
Joined: November 2nd, 2007, 10:34 pm
Location: Melbourne

Re: Prevent Players from leaving the game

Post by Ozzapoo »

Durchdringen wrote:I'm sure Xantan would know how to do it. He always disabled me from getting locked in the game and getting goatse'd, but the rest were screwed lol. So we already know theres a reverse, but making the game sensing people trying to get out is a different story.
You only didn't get locked because you were also activated in his cp....
Aero wrote:Lol...you could optimize that code to...

Code: Select all

function EveryFewMilliseconds takes nothing returns nothing
call ForceUICancel()
endfunction
Doesnt' that cause desyncs?
Visit Ozzapoo.net, my blog and the home of AutoCP and Cheatpack Detector!
AutoCP3 now available for free!
joe
Newcomer
Posts: 8
Joined: July 12th, 2008, 8:01 pm

Re: Prevent Players from leaving the game

Post by joe »

there's a map called South Park.w3x that is actually a rick-roll (shows the video and plays the music) and you can't use alt-f4 to exit or do anything. you have to ctrl-alt-del and kil the game that way. whatever they do you could copy.

however i have to suggest that preventing people from doing what they want isn't a good idea for a map author. 90% of the disconnects might be leavers but some people might need to alt-f4 because it's their bedtime or their boss walked into their cubicle or their class is starting or whatever. keeping them from closing the program is pretty obnoxious and if it happened to me i wouldn't play that map ever again

just my 2 cents :D
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Prevent Players from leaving the game

Post by Aero »

No, ForceUICancel() will not cause desyncs.
ForceUICancel() doesn't take a "whichPlayer" because "whichPlayer" happens to be GetLocalPlayer() (All players).

This is why if you only want to ForceUICancel() for ONE player, you need to do a comparison.
User avatar
CrackUps
Member
Posts: 96
Joined: October 6th, 2007, 12:21 am

Re: Prevent Players from leaving the game

Post by CrackUps »

The trigger from the Rick Roll map is this:

function Trig_NoLeave_Actions takes nothing returns nothing
call SetUserControlForceOff(bj_FORCE_ALL_PLAYERS)
call SetUserControlForceOn(bj_FORCE_ALL_PLAYERS)
endfunction

function InitTrig_NoLeave takes nothing returns nothing
set gg_trg_NoLeave = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_NoLeave, 0.01 )
call TriggerAddAction( gg_trg_NoLeave, function Trig_NoLeave_Actions )
endfunction

It is possible to leave if you press Alt+Q fast enough or Alt+F4 but its still frustrating