-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
61 changed files
with
475 additions
and
103 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-- Don't touch hit | ||
_G.Config = {} | ||
_G.oncache = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
local RemoveBlip <const> = RemoveBlip | ||
local AddBlipForCoord <const> = AddBlipForCoord | ||
local SetBlipSprite <const> = SetBlipSprite | ||
local SetBlipColour <const> = SetBlipColour | ||
local SetBlipScale <const> = SetBlipScale | ||
local SetBlipAsShortRange <const> = SetBlipAsShortRange | ||
local BeginTextCommandSetBlipName <const> = BeginTextCommandSetBlipName | ||
local AddTextComponentSubstringPlayerName <const> = AddTextComponentSubstringPlayerName | ||
local EndTextCommandSetBlipName <const> = EndTextCommandSetBlipName | ||
local DoesBlipExist <const> = DoesBlipExist | ||
|
||
local function Delete(self) | ||
if self[1] then | ||
for i = 1, #self do | ||
if self[i].blip and DoesBlipExist(self[i].blip) then RemoveBlip(self[i].blip) end | ||
end | ||
else | ||
if self.blip and DoesBlipExist(self.blip) then RemoveBlip(self.blip) end | ||
end | ||
return nil, collectgarbage() | ||
end | ||
|
||
local function Create(coords, data) | ||
if not data.sprite and not data.label and not data.color then return end | ||
|
||
local self, multiple = {}, false | ||
|
||
if type(coords) == 'table' then | ||
for i = 1, #coords do | ||
self[i] = {} | ||
self[i].coords = coords[i] | ||
self[i].sprite = data.sprite | ||
self[i].color = data.color | ||
self[i].label = data.label | ||
self[i].scale = data?.scale or 1.0 | ||
self[i].range = data?.range or true | ||
self[i].group = data?.group or nil | ||
self[i].remove = Delete | ||
end | ||
multiple = true | ||
elseif type(coords) == 'vector3' then | ||
self.coords = coords | ||
self.sprite = data.sprite | ||
self.label = data.label | ||
self.color = data.color | ||
self.scale = data?.scale or 1.0 | ||
self.range = data?.range or true | ||
self.group = data?.group or nil | ||
self.remove = Delete | ||
else return end | ||
|
||
CreateThread(function() | ||
if multiple then | ||
for i = 1, #self do | ||
self[i].blip = AddBlipForCoord(self[i].coords) | ||
SetBlipSprite(self[i].blip, self[i].sprite) | ||
SetBlipColour(self[i].blip, self[i].color) | ||
SetBlipScale(self[i].blip, self[i].scale) | ||
SetBlipAsShortRange(self[i].blip, self[i].range) | ||
BeginTextCommandSetBlipName('STRING') | ||
AddTextComponentSubstringPlayerName(self[i].label) | ||
EndTextCommandSetBlipName(self[i].blip) | ||
end | ||
else | ||
self.blip = AddBlipForCoord(self.coords) | ||
SetBlipSprite(self.blip, self.sprite) | ||
SetBlipColour(self.blip, self.color) | ||
SetBlipScale(self.blip, self.scale) | ||
SetBlipAsShortRange(self.blip, self.range) | ||
BeginTextCommandSetBlipName('STRING') | ||
AddTextComponentSubstringPlayerName(self.label) | ||
EndTextCommandSetBlipName(self.blip) | ||
end | ||
end) | ||
|
||
return self | ||
end | ||
|
||
return { | ||
new = Create | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
local math <const>, type <const>, tonumber <const> = math, type, tonumber | ||
|
||
--- math.round | ||
--- | ||
---@param num number | ||
---@param numDecimalPlaces? number | ||
---@return number | ||
local function Round(num, numDecimalPlaces) | ||
return tonumber(string.format("%."..(numDecimalPlaces or 0).."f", num)) | ||
end | ||
|
||
--- math.chance | ||
--- | ||
---@param percent number | ||
---@param cb? function | ||
---@return boolean | ||
local function Chance(percent, cb) | ||
if type(percent) ~= 'number' then return end | ||
if percent < 1 then return false end | ||
if percent > 99 then return true end | ||
local result = math.random(1,100) | ||
if cb then | ||
cb(result) | ||
end | ||
return result <= percent | ||
end | ||
|
||
return { | ||
round = Round, | ||
chance = Chance, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local IsOpen = false | ||
|
||
|
||
local function CreateMenu(title, subtitle, options) | ||
|
||
if IsOpen then return end | ||
|
||
local self = {} | ||
|
||
self.title = title | ||
self.subtitle = subtitle | ||
self.options = options | ||
|
||
return self | ||
end | ||
|
||
RegisterNetEvent('supv_core:nativeui:menuIsShow', function(open) | ||
IsOpen = open | ||
end) | ||
|
||
return { | ||
menu = CreateMenu | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.