[Standalone] TP-Inputs


TP-Inputs allows you to create a Text Field input, Multiple Options Input and Buttons Selection Inputs which both return the selected / typed value.

Fully responsive to all screen resolutions.

How to use Buttons Selection?

When clicking a button, it will return ACCEPT or DECLINE values as a String.

local inputData = {
    title = "Your title",
    desc = "Your description",
    buttonparam1 = "ACCEPT",
    buttonparam2 = "DECLINE"
}
                            
TriggerEvent("tp_inputs:getButtonInput", inputData, function(cb)

    if cb == "ACCEPT" then
        -- do action
    end
end) 

How to use Buttons Selection with returned values?

When clicking a button, it will return BUY or SELL values as a String.

local inputData = {
    title = "Your title",
    desc = "Your description",
    buttonparam1 = "BUY",
    buttonparam2 = "SELL"
}
                            
TriggerEvent("tp_inputs:getButtonReturnedValuesInput", inputData, function(cb)

    if cb == "BUY" then
        -- do action
    end
end) 

How to use Text Inputs?

When clicking ACCEPT button, it will return the input text value as a String.

local inputData = {
    title = "Your title",
    desc = "Your description",
    buttonparam1 = "ACCEPT",
    buttonparam2 = "DECLINE"
}
                            
TriggerEvent("tp_inputs:getTextInput", inputData, function(cb)

    if cb == "TEST" then
        -- do action
    end
end) 

How to use Multiple Option Inputs?

When clicking ACCEPT button, it will return the selected option text value as a String.

local inputData = {
    title = "License Registration",
	desc  = "What license registration type would you like to create?",
	buttonparam1 = "ACCEPT",
	buttonparam2 = "DECLINE",

	options = {} -- <- The list with the name values.
}
	
TriggerEvent("tp_inputs:getSelectedOptionsInput", inputData, function(cb)
	if cb == "something" then
          -- do action
	end
			
end)

How to use a slider?

When clicking ACCEPT button, it will return the selected option text value as a String.

local inputData = {
    title = "Insert Quantity",
	desc  = "how much quantity would you like to withdraw?",
	buttonparam1 = "ACCEPT",
	buttonparam2 = "DECLINE",
	min          = 1, -- <- minimum quantity
	max          = 20, -- <- maximum quantity
}
	
TriggerEvent("tp_inputs:getSliderResult", inputData, function(cb)
	if cb ~= "DECLINE" then
          -- do action (returns an integer)
	end
			
end)

How to use an advanced slider?

When clicking ACCEPT button, it will return the selected option text value as a String.

local inputData = {
    title            = "Insert Quantity",
	desc             = "how much quantity would you like to withdraw?",
	buttonparam1     = "ACCEPT",
	buttonparam2     = "DECLINE",
	min              = 1, -- <- minimum quantity,
	max              = 20, -- <- maximum quantity,
    cost             = 0.10, -- <- item cost x1
    cost_description = "you will pay: ",
    cost_currency    = " dollars,
}
	
TriggerEvent("tp_inputs:getAdvancedSliderResult", inputData, function(cb)
	if cb ~= "DECLINE" then
          -- do action (returns an integer)
	end
			
end)

This script will be an extra semi-requirement for my free or paid scripts and also can be used for anyone who is interested.

Github: [GitHub - TitansProductions/tp_inputs)

2 Likes

Updated to version 1.1.0

New feature added for getting the returned clicked values.

How to use Buttons Selection with returned values?

When clicking a button, it will return BUY or SELL values as a String.

local inputData = {
    title = "Your title",
    desc = "Your description",
    buttonparam1 = "BUY",
    buttonparam2 = "SELL"
}
                            
TriggerEvent("tp_inputs:getButtonReturnedValuesInput", inputData, function(cb)

    if cb == "BUY" then
        -- do action
    end
end) 

Updated to version 1.2.0

New feature added for adding and getting the returned option values.

1 Like

The github link has been restored, it was an old one which didnt exist.

New features have also been added for those who are interested.