-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.lua
More file actions
80 lines (75 loc) · 2.34 KB
/
Copy pathutils.lua
File metadata and controls
80 lines (75 loc) · 2.34 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
resourceRoot = getResourceRootElement(getThisResource())
function lendir(len, dir) -- LENDIR FUNCTION MTA SA MODEL
if dir >= 0 and dir <= 90 then
local delta = math.rad(dir)
local rangle = math.rad(90)
local a = len*math.sin(rangle-delta) --Positive Y
local b = len*math.sin(delta) -- Negative X
return -b, a
end
if dir > 90 and dir <= 180 then
dir = dir - 90
local delta = math.rad(dir)
local rangle = math.rad(90)
local a = len*math.sin(rangle-delta) --Negative X
local b = len*math.sin(delta) -- Negative Y
return -a, -b
end
if dir > 180 and dir <= 270 then
dir = dir - 180
local delta = math.rad(dir)
local rangle = math.rad(90)
local a = len*math.sin(rangle-delta) --Negative Y
local b = len*math.sin(delta) -- Positive X
return b, -a
end
if dir > 270 and dir <= 360 then
dir = dir - 270
local delta = math.rad(dir)
local rangle = math.rad(90)
local a = len*math.sin(rangle-delta) --Positive Y
local b = len*math.sin(delta) -- Positive X
return a, b
end
end
function getPlayers()
local players = {}
for k,v in ipairs(getAlivePlayers()) do
table.insert(players,v)
end
for k,v in ipairs(getDeadPlayers()) do
table.insert(players,v)
end
return players
end
--[[local newfile = fileCreate("ROAD.txt")
roadmarkers = {}
fileWrite( newfile, "road = {")
local posi = 1
function addpoint ( targetElem,command, carid )
if ( isElement(targetElem) and getElementType (targetElem) == "player" ) then
local x,y,z = getElementPosition(getPedOccupiedVehicle(targetElem))
roadmarkers[posi] = createMarker ( x, y, z, "checkpoint", 4.0, 127, 127, 255, 255, player )
posi = posi + 1
end
end
addCommandHandler("addpoint",addpoint)
function clsfl ( player,command )
posi = 1
for k, v in ipairs(roadmarkers) do
local x,y,z = getElementPosition ( roadmarkers[k] )
outputChatBox("x "..x .. " y " .. y .. " z " .. z)
fileWrite(newfile, "["..posi.."] = {"..x ..", ".. y .. ", " .. z .. "},\n")
destroyElement ( roadmarkers[k] )
roadmarkers[k] = nil
posi = posi + 1
end
fileClose(newfile)
end
addCommandHandler("doneroad",clsfl)
function dellast ( player,command )
posi = posi - 1
destroyElement ( roadmarkers[posi] )
roadmarkers[posi] = nil
end
addCommandHandler("delmarker",dellast)]]