Facepunch / garrysmod-issues

Garry's Mod issue tracker
147 stars 56 forks source link

Connect Prompt makes GMod unusable if run in Think hook #4735

Closed WinterPhoenix closed 3 years ago

WinterPhoenix commented 4 years ago

Details

Protocol version 24 Exe version 2020.10.14 (garrysmod) Exe build: 17:22:36 Nov 2 2020 (7881) (4000) GMod version 2020.11.09, branch: x86-64, multicore: 1 Windows 64bit

Steps to reproduce

  1. Open GMod and start a game of Sandbox in Singleplayer
  2. Run in console: lua_run Entity(1):SendLua([[hook.Add("Think", "whoops", function() LocalPlayer():ConCommand("connect someserverip") end)]])

Actual behavior

Expected behavior

This bug was discovered due to some 6+ year old code as part of a hook in one of my gamemodes that handles auto-rejoin. The code assumed Think exits immediately after the connect command is run.

I'm aware that it was poorly written, but I can't be the only one.

mcNuggets1 commented 4 years ago

Same with gui.OpenURL?

aStonedPenguin commented 4 years ago

It doesn't have to be a think hook. Just stack some connection attempts. The more attempts the more you have to spam the yes or no button to make the popup go away.

gui.OpenURL() isn't effected.

for i=1,100 do LocalPlayer():ConCommand'connect srv.ip' end

robotboy655 commented 3 years ago

It doesn't have to be a think hook. Just stack some connection attempts. The more attempts the more you have to spam the yes or no button to make the popup go away. gui.OpenURL() isn't effected.

That's simply not true. They are literally using the exact same system. The previous confirmation gets discarded every time a new one is sent to the player.

That being said, it should be better now on Dev, x86-64 will receive this shortly as well.

Added "Disconnect" button to the openurl/connect confirmation dialogs
openurl/connect confirmation dialog is more resistive to spam, the "Yes"  button is initially disabled for 2 seconds
WilliamVenner commented 3 years ago

openurl/connect confirmation dialog is more resistive to spam, the "Yes" button is initially disabled for 2 seconds

Wait.. what?

robotboy655 commented 3 years ago

?

WilliamVenner commented 3 years ago

Why does it need to be disabled initially for 2 seconds?

robotboy655 commented 3 years ago

So you don't click on it accidentally.

WilliamVenner commented 3 years ago

Fair enough.

robotboy655 commented 3 years ago

It also helps with sneaky fucks who'd send you a different link like 1 second after sending you the initial confirmation.

aStonedPenguin commented 3 years ago

That's simply not true. They are literally using the exact same system. The previous confirmation gets discarded every time a new one is sent to the player.

On the build listed by @WinterPhoenix you still have to click more than once which does not happen with gui.OpenURL()
see here

WinterPhoenix commented 3 years ago

Is that in Singleplayer or Multiplayer?

aStonedPenguin commented 3 years ago

multiplayer