Skip to content

Commit

Permalink
Update v0.2.4
Browse files Browse the repository at this point in the history
- Updated import method

This doesn't affect to older versions!
  • Loading branch information
pitermcflebor committed Nov 29, 2020
1 parent 3210869 commit 1d5b2d8
Show file tree
Hide file tree
Showing 17 changed files with 256 additions and 400 deletions.
13 changes: 2 additions & 11 deletions classes/client/coords.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('coords', function()
return
[=[_G.Coords = {}
_G.Coords = {}
_G.CoordsMethods = {}

-- methods
Expand Down Expand Up @@ -147,10 +144,4 @@ CoordsMethods.__call = function(self, ...)
end

-- class
setmetatable(Coords, CoordsMethods)]=]
end)
else
local func, err = load(exports.classes:coords())
assert(func, err)
func()
end
setmetatable(Coords, CoordsMethods)
13 changes: 2 additions & 11 deletions classes/client/marker.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('marker', function()
return
[=[_G.Marker = {}
_G.Marker = {}
_G.MarkerMethods = {}

-- init
Expand Down Expand Up @@ -92,10 +89,4 @@ MarkerMethods.__index = {
}

-- class
setmetatable(Marker, MarkerMethods)]=]
end)
else
local func, err = load(exports.classes:marker())
assert(func, err)
func()
end
setmetatable(Marker, MarkerMethods)
13 changes: 2 additions & 11 deletions classes/client/ped.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('ped', function()
return
[=[_G.Ped = {}
_G.Ped = {}
_G.PedMethods = {}

PedMethods.__call = function(self, newPed, p1, pedType, x,y,z,w, isNetwork)
Expand Down Expand Up @@ -128,10 +125,4 @@ PedMethods.__index = {
end,
}

setmetatable(Ped, PedMethods)]=]
end)
else
local func, err = load(exports.classes:ped())
assert(func, err)
func()
end
setmetatable(Ped, PedMethods)
13 changes: 2 additions & 11 deletions classes/client/player.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('player', function()
return
[=[_G.CPlayer = {}
_G.CPlayer = {}
_G.PlayerMethods = {}

PlayerMethods.__call = function(self, source)
Expand Down Expand Up @@ -94,10 +91,4 @@ PlayerMethods.__index = {
end
}

setmetatable(CPlayer, PlayerMethods)]=]
end)
else
local func, err = load(exports.classes:player())
assert(func, err)
func()
end
setmetatable(CPlayer, PlayerMethods)
13 changes: 2 additions & 11 deletions classes/client/prop.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('prop', function()
return
[=[_G.Prop = {}
_G.Prop = {}
_G.PropMethods = {}

PropMethods.__call = function(self, newProp, p1, coords, isNetwork, freezeOnSpawn)
Expand Down Expand Up @@ -125,10 +122,4 @@ PropMethods.__index = {
end,
}

setmetatable(Prop, PropMethods)]=]
end)
else
local func, err = load(exports.classes:prop())
assert(func, err)
func()
end
setmetatable(Prop, PropMethods)
13 changes: 2 additions & 11 deletions classes/client/statebag.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('statebag', function()
return
[=[_G.StateBag = {}
_G.StateBag = {}
_G.StateBagMethods = {}


Expand Down Expand Up @@ -68,10 +65,4 @@ StateBagMethods.__index = {
}


setmetatable(StateBag, StateBagMethods)]=]
end)
else
local func, err = load(exports.classes:statebag())
assert(func, err)
func()
end
setmetatable(StateBag, StateBagMethods)
11 changes: 1 addition & 10 deletions classes/client/utils.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('utils', function()
return
[=[_G._type = function(obj)
_G._type = function(obj)
if type(obj) == 'table' then
local meta = getmetatable(obj)
if meta ~= nil then
Expand Down Expand Up @@ -241,10 +238,4 @@ _G.GetNearestVehicles = function(coords, radius, sorted)
end
if not sorted then return t
else return table.sorted(t, 'distance') end
end]=]
end)
else
local func, err = load(exports.classes:utils())
assert(func, err)
func()
end
13 changes: 2 additions & 11 deletions classes/client/vehicle.lua
@@ -1,8 +1,5 @@

if GetCurrentResourceName() == 'classes' then -- fix for older versions
exports('vehicle', function()
return
[=[_G.Vehicle = {}
_G.Vehicle = {}
_G.VehicleMethods = {}

VehicleMethods.__call = function(self, newVehicle, p1, x, y, z, heading, isNetwork)
Expand Down Expand Up @@ -424,10 +421,4 @@ VehicleMethods.__index = {
end,
}

setmetatable(Vehicle, VehicleMethods)]=]
end)
else
local func, err = load(exports.classes:vehicle())
assert(func, err)
func()
end
setmetatable(Vehicle, VehicleMethods)
20 changes: 8 additions & 12 deletions classes/fxmanifest.lua
Expand Up @@ -2,7 +2,7 @@ fx_version 'cerulean'
games { 'gta5' }

developer 'PiterMcFlebor'
version '0.2.3'
version '0.2.4'
description [[
Classes script created by PiterMcFlebor (2020)
Expand All @@ -16,10 +16,7 @@ https://pitermcflebor.github.io/tutorial
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',
'import.lua',
files {
'client/utils.lua',
'client/coords.lua',
'client/statebag.lua',
Expand All @@ -28,6 +25,12 @@ client_scripts {
'client/player.lua',
'client/marker.lua',
'client/prop.lua',
}

client_scripts {
'misc/client/main.lua',
'misc/client/callbacks.lua',
'import.lua',
'misc/client/common.lua',
'misc/client/vehicle_props.lua',
'misc/client/states.lua',
Expand All @@ -39,11 +42,4 @@ server_scripts {
'misc/server/callbacks.lua',
'misc/server/states.lua',
'import.lua',
'server/utils.lua',
'server/coords.lua',
'server/statebag.lua',
'server/prop.lua',
'server/ped.lua',
'server/player.lua',
'server/vehicle.lua',
}
10 changes: 5 additions & 5 deletions classes/import.lua
Expand Up @@ -2,11 +2,11 @@
_G.import = function(t)
if type(t) == 'table' then
for _,className in pairs(t) do
local f = exports.classes[className]()
assert(f, 'The class '..className..' doesn\'t exists!')
local func, err = load(f)
assert(func, err)
func()
local rawLua = LoadResourceFile('classes', ("%s/%s.lua"):format((IsDuplicityVersion() and 'server' or 'client'), className))
assert(rawLua, 'Cannot import '..className)
local f, err = load(rawLua)
assert(f, err)
f()
end
elseif type(t) == 'string' then
if t == '*' then
Expand Down

0 comments on commit 1d5b2d8

Please sign in to comment.