Skip to content

Instantly share code, notes, and snippets.

View MrGrootx's full-sized avatar
💭
I may be slow to respond.

justgroot MrGrootx

💭
I may be slow to respond.
View GitHub Profile
@MrGrootx
MrGrootx / updater.lua
Created July 30, 2024 01:56
check fivem resource update
local function logMessage(_type, message)
local color = _type == 'success' and '^2' or '^1'
print(('^8[GD3V]%s %s^7'):format(color, message))
end
local function checkMenuVersion()
PerformHttpRequest('https://raw.githubusercontent.com/MrGrootx/g-updates/master/g-ownable-job-vehicle.txt',
function(err, text, headers)
if err ~= 200 then
logMessage('error', 'Unable to run a version check. Error: ' .. err)
@MrGrootx
MrGrootx / client.lua
Created March 1, 2024 13:51
qb core plate gen client side
local plate = "G-".. QBCore.Shared.RandomInt(1) .. QBCore.Shared.RandomStr(2) .. QBCore.Shared.RandomInt(2)
@MrGrootx
MrGrootx / overflow.js
Created February 27, 2024 13:10
js name Overflow
const name =
product.name.length > 21
? product.name.substring(0, 20) + ".."
: product.name;
@MrGrootx
MrGrootx / timer.lua
Last active February 23, 2024 11:51
fivem show timer as text
local remainingsec = 0
function disp_time(time)
local minutes = math.floor((time % 3600 / 60))
local seconds = math.floor((time % 60))
return string.format("%02dm %02ds", minutes, seconds)
end
-- startTimer()
function startTimer()
Citizen.CreateThread(function()
Citizen.CreateThread(function()
@MrGrootx
MrGrootx / .js
Created February 19, 2024 04:15
express with mongo id validate
const { id } = req.params;
if (!mongoose.Types.ObjectId.isValid(id)) {
return res.status(404).json({ msg: "Task not found" });
}
@MrGrootx
MrGrootx / esx.lua
Created February 14, 2024 01:12
esx DrawMarker with whitelist job
Citizen.CreateThread(function()
while true do
local coords = Config.vehicleSpawn.MarkerPos
local pedCoords = GetEntityCoords(PlayerPedId())
if ESX.PlayerData.job and ESX.PlayerData.job.name then
if ESX.GetPlayerData().job and ESX.GetPlayerData().job.name then
if ESX.GetPlayerData().job.name == "police" then
DrawMarker(21, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 0, 255, 20,
50, false, true, 2, false, nil, nil, false)
@MrGrootx
MrGrootx / email.js
Created February 13, 2024 05:00
react-hooks-form (email validation) with zod
email: z
.string()
.email({
message: "Enter a valid email address",
required_error: "email requried",
})
.trim()
.toLowerCase(),
@MrGrootx
MrGrootx / react.js
Last active February 13, 2024 04:58
react-hook-form ( checkbox input ) with custom message
checkbox : z.boolean().refine((v) => v === true, {
message: "checkbox message here",
}),