-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc_script.lua
65 lines (58 loc) · 2.8 KB
/
c_script.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
addEventHandler( 'onClientRender', root, function()
for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement(), true ) ) do
if getElementData( v, 'intEntranceData' ) then
local scX, scY = guiGetScreenSize();
local x, y, z = getElementPosition( v );
local cx, cy, cz = getCameraMatrix();
if isLineOfSightClear( cx, cy, cz, x, y, z, false, false, false, false, false, false, false, v ) then
local dist = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z );
if dist >= 5 and dist <= 15 then
local px, py = getScreenFromWorldPosition( x, y, z + 1.8, 0.06 );
if px then
local owner = getElementData( v, 'intEntranceData' )[1];
local intID = getElementData( v, 'intEntranceData' )[5];
local r, g, b = getMarkerColor( v );
if r == 0 and g == 153 and b == 255 then
r, g, b = 255, 255, 255;
end;
if owner and intID then
if owner == '' then owner = 'none'; end;
dxDrawText( 'This Base owns: '..owner, px + 1, py + scY/38, px + 1, py + 1, tocolor( 0, 0, 0, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawText( 'This Base owns: '..owner, px, py + scY/38, px, py, tocolor( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center', false, false );
dxDrawText( 'Base ID: '..intID, px, py + 70, px, py, tocolor( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center', false, false );
end;
end;
end;
end;
end;
end;
end );
addEventHandler( 'onClientRender', root, function()
for i, v in ipairs( getElementsByType( 'marker', getResourceRootElement(), true ) ) do
if getElementData( v, 'intExitData' ) then
local scX, scY = guiGetScreenSize();
local x, y, z = getElementPosition( v );
local cx, cy, cz = getCameraMatrix();
if isLineOfSightClear( cx, cy, cz, x, y, z, false, false, false, false, false, false, false, v ) then
local dist = getDistanceBetweenPoints3D( cx, cy, cz, x, y, z );
if dist >= 5 and dist <= 15 then
local px, py = getScreenFromWorldPosition( x, y, z + 1.8, 0.06 );
if px then
local r, g, b = getMarkerColor( v );
if r == 0 and g == 153 and b == 255 then
r, g, b = 255, 255, 255;
end;
dxDrawText( 'Write /exitbase to get out with vehicle', px + 1, py + scY/38, px + 1, py + 1, tocolor( 255, 255, 255, 255 ), 1, 'default-bold', 'center', 'center', false, false );
end;
end;
end;
end;
end
end);
addEvent( "CantFallOffBike", true )
addEventHandler( "CantFallOffBike", getLocalPlayer(),
function( )
setPedCanBeKnockedOffBike( getLocalPlayer(), false )
setTimer( setPedCanBeKnockedOffBike, 1050, 1, getLocalPlayer(), true )
end
)