Miscellaneous
[list]
[*]Fixed Auto-Accept Match
[/list]
Lua Scripting
[list]
[]Added DispatchUserMessage callback
[]Added UserMessage:GetID
[]Added UserMessage:GetInt
[]Added UserMessage:GetFloat
[]Added UserMessage:GetString
[]Added draw.CreateTexture
[]Added draw.UpdateTexture
[]Added draw.SetTexture
[]Allow opening png, svg and lua files
[]Allow opening files without extension (configs)
[]Added common.DecodePNG
[]Added common.RasterizeSVG
[]Added http.Get
[list]
[]Currently blocking IO and only allows GET requests
[/list]
[]Added "Allow Lua HTTP connections" option
[]Added "Allow Script/Config editing from Lua" option
[]Following commands are restricted from being edited by lua:
[list]
[]msc_restrict
[]lua_allow_http
[]lua_allow_cfg
[/list]
[/list]
Example chat logging script:
-- For more information about user messages look here:
-- https://github.com/SteamDatabase/Protobufs/blob/master/csgo/cstrike15_usermessages.proto
local function UserMessageCallback( msg )
-- CS_UM_SayText2
if msg:GetID() == 6 then
-- CCSUsrMsg_SayText2.ent_idx
local index = msg:GetInt( 1 );
-- CCSUsrMsg_SayText2.params
local message = msg:GetString( 4, 1 );
local name = client.GetPlayerNameByIndex( index );
print( name .. " says: " .. message );
end
end
callbacks.Register( "DispatchUserMessage", "UserMessageExample", UserMessageCallback );
Example loading svg image from web (requires Lua HTTP connections enabled)
local svgData = http.Get( "https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg" );
local imgRGBA, imgWidth, imgHeight = common.RasterizeSVG( svgData );
local texture = draw.CreateTexture( imgRGBA, imgWidth, imgHeight );
local function ExampleTextureDrawing()
draw.SetTexture( texture );
draw.FilledRect( 0, 0, imgWidth, imgHeight );
end
callbacks.Register( "Draw", "ExampleTextureDrawing", ExampleTextureDrawing );