Skip to content

Commit

Permalink
Update v0.1.6
Browse files Browse the repository at this point in the history
- Added version check
- Added new method to Ped client-side
  • Loading branch information
pitermcflebor committed Oct 21, 2020
1 parent ae5a725 commit a2df2a0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
6 changes: 5 additions & 1 deletion classes/client/ped.lua
Expand Up @@ -142,7 +142,11 @@ PedMethods.__index = {
if self:Exists() then
ClearPedTasks(self.id)
end
end
end,

SetDefaultComponents = function(self)
SetPedDefaultComponentVariation(self.id)
end,
}

setmetatable(Ped, PedMethods)
6 changes: 5 additions & 1 deletion classes/fxmanifest.lua
Expand Up @@ -2,9 +2,12 @@ fx_version 'cerulean'
games { 'gta5' }

developer 'PiterMcFlebor'
version '1.0'
version '0.1.6'
description 'Classes for FiveM with Lua'

disable_version_check 'no' -- set this to 'yes' if you don't want to check the current version
disable_version_check_message 'no' -- set this to 'yes' if you only want to disable the 'is up to date' message log

client_scripts {
'misc/client/main.lua',
'misc/client/callbacks.lua',
Expand All @@ -26,6 +29,7 @@ client_scripts {
}

server_scripts {
'misc/server/versioncheck.lua',
'misc/server/main.lua',
'misc/server/callbacks.lua',
'misc/server/states.lua',
Expand Down
55 changes: 55 additions & 0 deletions classes/misc/server/versioncheck.lua
@@ -0,0 +1,55 @@
local errorLabel =
[[
^4=================================
^1CLASSES: Version check failed!
^4=================================
^7
]]

local uptodateLabel =
[[
^4==============================
^2CLASSES: Is up to date!
^3 Disable version check?
^3 Check the fxmanifest.lua
^4==============================
^7
]]

local versionmismatchLabel =
[[
^4==========================================
^1CLASSES: Version mismatch!
^1 You're running ^6%s ^1and there's a ^6%s
^1 Download the new version from Github!
^3 Disable version check?
^3 Check the fxmanifest.lua
^4==========================================
^7
]]

CreateThread(function()
local disableVersionCheck = GetResourceMetadata(GetCurrentResourceName(), 'disable_version_check') == 'yes'
local disableVersionMessage = GetResourceMetadata(GetCurrentResourceName(), 'disable_version_check_message') == 'yes'
if not disableVersionCheck then
Wait(20000)
PerformHttpRequest('https://raw.githubusercontent.com/pitermcflebor/pitermcflebor.github.io/master/classes.version',
function(err,body)
if err == 200 then
local version = GetResourceMetadata(GetCurrentResourceName(), 'version')
if version == tostring(body) then
if not disableVersionMessage then
print(uptodateLabel)
end
else
print(versionmismatchLabel:format(version or 'Unkown', body))
end
else
print(errorLabel)
end
end, 'GET', json.encode({}), {ContentType = 'html/text'})
end
end)

0 comments on commit a2df2a0

Please sign in to comment.