- Documentation
- Server functions
- svgCreate
Function
svgCreate
Creates an SVG document (vector graphics) on the server with the given size in pixels and XML content. The document holds content that can be changed and read (e.g. generate a chart or badge and send its text to clients with an event). The optional function receives the finished document.
Syntax
element svgCreate(int width, int height [, string pathOrRawData = "", function callback = nil])Arguments
widthint- Width in pixels.
heightint- Height in pixels.
pathOrRawDatastring, optional = ""- SVG content (XML).
callbackfunction, optional = nil- A function called with the document.Not in MTA:SA
Differences from MTA:SA
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
svgCreate(int width, int height, string svg)Returns
An svg element, or false.
Example
local badge = svgCreate(64, 64, '<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><circle cx="32" cy="32" r="30" fill="gold"/></svg>')
addEventHandler("onPlayerJoin", root, function()
triggerClientEvent(source, "onBadge", resourceRoot, svgGetDocumentXML(badge))
end)
Notes
Limitation. The document is not drawn; use the dxDraw functions to draw on screen.