Garry's Mod

Garry's Mod

ColorMater Tool
jimbo 16 Jul, 2013 @ 12:50am
Prevent players coloring
Is there a way to prevent players coloring other players?
< >
Showing 1-1 of 1 comments
jimbo 16 Jul, 2013 @ 5:13am 
I managed to get this working (with addon mounted from Workshop) like this:

function SetRestrictions (list)
local set = {}
for _, l in ipairs(list) do set[l] = true end
return set
end

function StopPlayerColoring(_, trace, tool)
local ent = trace.Entity

local ToolsThatCantActOnPlayers = SetRestrictions { "colour", "material", "paint", "colmat" }

if ToolsThatCantActOnPlayers[tool] and ent:GetClass() == "player" then
return false
end
end

hook.Add("CanTool", "Stop ♥♥♥♥♥♥♥ Minges Ruining my Fun", StopPlayerColoring)

in lua/autorun/whatever.lua

Thought it would be a good thing sharing it.
< >
Showing 1-1 of 1 comments
Per page: 1530 50