Quantum is a Garry's Mod RPG framework.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
quantum/gamemode/engine/lib/server/sv_notify.lua

35 lines
1.3 KiB

-- __ _ _______ _ __
-- / / /\ | | |__ __| | | \ \
-- / / / \ | |_ __ ___ | | ___ ___| |__ \ \
-- < < / /\ \ | | '_ ` _ \| |/ _ \/ __| '_ \ > >
-- \ \ / ____ \| | | | | | | | __/ (__| | | | / /
-- \_\ /_/ \_\_|_| |_| |_|_|\___|\___|_| |_| /_/
Quantum.Notify = {}
local function makeColorAString( clr )
return "Color(" .. tostring( clr.r ) .. "," .. tostring( clr.g ) .. "," .. tostring( clr.b ) .. ")"
end
local baseClr = Color( 220, 220, 220 )
function Quantum.Notify.ItemPickup( pl, item, amount )
local amtStr = ""
if( amount > 1 ) then amtStr = tostring(amount) .. "x " end
local itemColor = item.rarity.color || baseClr
local itemName = item.name || "[ERROR name=nil]"
local luaArgs = makeColorAString(baseClr) .. ",'You picked up '," .. makeColorAString(baseClr) .. ",'" .. tostring(amtStr) .. "'," .. makeColorAString(itemColor) .. "," .. "'" .. tostring(itemName) .. "'"
local luaFunc = "chat.AddText(" .. luaArgs .. ")"
pl:SendLua( luaFunc )
end
function Quantum.Notify.Deny( pl, text )
local luaArgs = makeColorAString( Color( 245, 20, 20 ) ) .. ",'" .. tostring( text ) .. "'"
local luaFunc = "chat.AddText(" .. luaArgs .. ")"
pl:SendLua( luaFunc )
end