-
Notifications
You must be signed in to change notification settings - Fork 0
/
core_sh.lua
66 lines (56 loc) · 1.59 KB
/
core_sh.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
resourceName = getResourceName(resource)
string.endswith = function(self, ending)
return ending == '' or self:sub(-#ending) == ending
end
GetFileData = function(path)
local file = fileOpen(path, true)
if not file then return end
local size = fileGetSize(file)
if not size then return end
local content = fileRead(file, size)
fileClose(file)
return content
end
ML = {}
ML.Funcs = {}
ML.Const = {
VehicleID = 400,
PedID = 7,
ObjectID = 1337,
ClumpModels = 3425,
TimedObjects = 4715
}
ML.Funcs.CreateModel = function(modelType, ...)
assert(type(modelType) == 'string', 'Expected string at argument 1, got '..type(modelType))
modelType = modelType:lower()
local model
if modelType == 'vehicle' then
model = createVehicle(ML.Const.VehicleID, ...)
elseif modelType == 'ped' then
model = createPed(ML.Const.PedID, ...)
elseif modelType == 'object' then
model = createObject(ML.Const.ObjectID, ...)
end
end
CreateModel = ML.Funcs.CreateModel
ML.Funcs.XML = {}
ML.Funcs.XML.LoadData = function(node)
local propertyName = xmlNodeGetAttribute(node, 'name')
local propertyValue = xmlNodeGetAttribute(node, 'value')
-- vehicle data
if ML.Const.VehicleProperties[propertyName] then
return propertyName, propertyValue
end
-- ped data
if ML.Const.PedStats[propertyName] ~= nil then
return propertyName, propertyValue
end
if ML.Const.WalkingStyles[propertyName] ~= nil then
return propertyName, propertyValue
end
if ML.Const.PedVoices[propertyName] then
if ML.Const.PedVoices[propertyName][propertyValue] then
return propertyName, propertyValue
end
end
end