Facepunch / garrysmod-issues

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

Setting the material of entities to any "pp/" material allows users to turn peoples screen to a color till they rejoin. #5157

Closed wrefgtzweve closed 9 months ago

wrefgtzweve commented 2 years ago

Details

Using ENT:SetMaterial or ENT:SetSubMaterial to set any material that starts with "pp/" will turn players screens to the color of the entity, Example: ENT:SetMaterial "pp/copy" on a prop with a black color, whenever a halo is drawn player screens will turn black. This only fixes itself until the player rejoins or a new pp material has been set with the color white. This bug is exploited by people, some addons allow for custom material input and allow players to turn everyones screen on the server black. There's a fix made by https://github.com/brandonsturgeon, https://github.com/CFC-Servers/cfc_restrict_materials. It would be great to see a fix like this in the game itself to prevent people from abusing this.

Steps to reproduce

  1. Spawn 2 props
  2. Paint prop 1 black.
  3. SetMaterial of prop 1 to "pp/copy"
  4. Pick up second prop with a physgun
  5. Screen should turn black.
robotboy655 commented 2 years ago

This again falls under mods allowing users to do this. The default material tool does not allow to do this.

robotboy655 commented 2 years ago

Should be fixed on Dev beta, and in the future updates.

robotboy655 commented 2 years ago

If you are interested in what the fix is: https://github.com/Facepunch/garrysmod/commit/a423d32b892dec58a05da0d8793832846931e560

adamnejm commented 10 months ago

@robotboy655 It still happens for translucent entities. The lower the alpha, the stronger the effect.

local ent = LocalPlayer():GetEyeTrace().Entity
if ent and ent:IsValid() then
    ent:SetRenderMode(RENDERMODE_TRANSCOLOR)
    ent:SetColor(Color(0, 0, 0, 1))
    ent:SetMaterial("pp/copy")
end

Linux on the 64-bit branch.

robotboy655 commented 9 months ago

Should be fixed on dev, same fix as last time, just also sets $alpha to 1.