Examples
This page is dedicated to lua example scripts
Examples
Watermark
-- Capture table insantances
local Render = fatality.render
local Config = fatality.config
local Menu = fatality.menu
local Callbacks = fatality.callbacks
-- Add a config item
local CheckboxConfigItem = Config:add_item( "Example Watermark Item", 0)
-- Add a checkbox
Menu:add_checkbox( "Example Watermark", "Visuals", "Misc", "Various", CheckboxConfigItem )
-- Get the colors of the menu
local BorderColor = csgo.color(58, 36, 107, 255)
local BackgroundColor = csgo.color(26, 22, 64, 200)
-- Create a font
local Verdana = Render:create_font( "verdana", 12, 0, 0 )
-- Set how many pixels of spacing we want
local Spacing = csgo.vector2(10, 10)
local function OnPaint()
-- Check if our checkbox is on (get_bool() == true)
-- If not then do nothing and return
if not CheckboxConfigItem:get_bool() then
return
end
-- Get our screensize
local ScreenSize = Render:screen_size()
-- Calculate the text size of the cheat name
local TextSize = Render:text_size( Verdana, "Fatality.win" )
-- Calculate our text size with spacing
local Size = csgo.vector2(TextSize.x + (3 * 2), TextSize.y + (3 * 2))
local Position = csgo.vector2(ScreenSize.x - Size.x - Spacing.x, Spacing.y)
-- Render background
Render:rect_filled( Position.x, Position.y, Size.x, Size.y, BackgroundColor)
Render:rect( Position.x, Position.y, Size.x, Size.y, BorderColor)
-- Render our text
Render:text( Verdana, Position.x + 3, Position.y + 3, "Fatality.win", csgo.color(255, 255, 255, 255) )
end
-- Add "paint" to our callback
Callbacks:add( "paint", OnPaint )Local hurt log
Last updated