44 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
---
 | 
						|
--- @author Dylan MALANDAIN
 | 
						|
--- @version 2.0.0
 | 
						|
--- @since 2020
 | 
						|
---
 | 
						|
--- RageUI Is Advanced UI Libs in LUA for make beautiful interface like RockStar GAME.
 | 
						|
---
 | 
						|
---
 | 
						|
--- Commercial Info.
 | 
						|
--- Any use for commercial purposes is strictly prohibited and will be punished.
 | 
						|
---
 | 
						|
--- @see RageUI
 | 
						|
---
 | 
						|
 | 
						|
 | 
						|
---@class Keys
 | 
						|
Keys = {};
 | 
						|
 | 
						|
---Register
 | 
						|
---@param Controls string
 | 
						|
---@param ControlName string
 | 
						|
---@param Description string
 | 
						|
---@param Action function
 | 
						|
---@return Keys
 | 
						|
---@public
 | 
						|
function Keys.Register(Controls, ControlName, Description, Action)
 | 
						|
    local _Keys = {
 | 
						|
        CONTROLS = Controls
 | 
						|
    }
 | 
						|
    RegisterKeyMapping(string.format('rageui-%s', ControlName), Description, "keyboard", Controls)
 | 
						|
    RegisterCommand(string.format('rageui-%s', ControlName), function(source, args)
 | 
						|
        if (Action ~= nil) then
 | 
						|
            Action();
 | 
						|
        end
 | 
						|
    end, false)
 | 
						|
    return setmetatable(_Keys, Keys)
 | 
						|
end
 | 
						|
 | 
						|
---Exists
 | 
						|
---@param Controls string
 | 
						|
---@return boolean
 | 
						|
function Keys:Exists(Controls)
 | 
						|
    return self.CONTROLS == Controls and true or false
 | 
						|
end
 |