It's possible, but you'd have to override a number of CLSCORE functions.
EVENT_PANTS = 800 -- unique number that I won't be using anytime soon
-- ... during the round at some point
if SERVER then SCORE:AddEvent({id=EVENT_PANTS, num=23}) end
-- ...
if CLIENT then
-- reroute CLSCORE function to handle our custom event
local oldTextForEvent = CLSCORE.TextForEvent
function CLSCORE:TextForEvent(e)
if e.id == EVENT_PANTS then
return "Someone wore " .. e.num .. " pants."
end
-- process other events as usual
return oldTextForEvent(self, e)
end
-- do the same for IconForEvent
end
Still, would be nice to have a better way.
I don't like the idea of an EVENT_CUSTOM where the server has to send the entire text to clients, that's quite a lot of data.
It would be pretty easy to have something like this:
CLSCORE.DeclareEventDisplay(EVENT_PANTS,
{ text = function(e)
return "Someone wore " .. e.num .. "pants."
end,
icon = function(e)
return myiconmaterial, "MyTooltip"
end
})
I believe all the existing events could be implemented this way, so it should be sufficient.