Code |
//This part is from the gmod_tool code. Basically an alias.
function ToolObj:GetClientNumber( property, default )
default = default or 0
local mode = self:GetMode()
return self:GetOwner():GetInfoNum( mode.."_"..property, default )
end
//This part is from the Color stool code.
function TOOL:LeftClick( trace )
if trace.Entity && // Hit an entity
trace.Entity:IsValid() && // And the entity is valid
trace.Entity:EntIndex() != 0 // And isn't worldspawn
then
//Clients can leave now.
if (CLIENT) then
return true
end
local r = self:GetClientNumber( "r", 0 )
local g = self:GetClientNumber( "g", 0 )
local b = self:GetClientNumber( "b", 0 )
local a = self:GetClientNumber( "a", 0 )
local mode = self:GetClientNumber( "mode", 0 )
local fx = self:GetClientNumber( "fx", 0 )
SetColour( self:GetOwner(), trace.Entity, { Color = Color( r, g, b, a ), RenderMode = mode, RenderFX = fx } )
return true
end
end
|