-
Notifications
You must be signed in to change notification settings - Fork 2
/
Hooks.lua
87 lines (52 loc) · 1.87 KB
/
Hooks.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---------------------------------------------------------
---------------[[Created by STR_Warrior]]----------------
---------------------------------------------------------
function OnSpawningEntity(World, Entity)
if (Entity:IsPlayer()) then
return false
end
local IsInside = g_PosCheckIsInside(World, Entity:GetChunkX(), Entity:GetChunkZ())
if (not IsInside) then
return true
end
end
function OnPlayerRightClick(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
if (BlockFace == BLOCK_FACE_NONE) then -- The client sends two packets. One with these coordinates. We don't want that one.
return false
end
if (Player:HasPermission("limitworld.bypass")) then
return false
end
local IsInside = g_PosCheckIsInside(Player:GetWorld(), math.floor(BlockX / 16), math.floor(BlockZ / 16))
if (not IsInside) then
return true
end
end
function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, BlockType, BlockMeta)
if (Player:HasPermission("limitworld.bypass")) then
return false
end
local IsInside = g_PosCheckIsInside(Player:GetWorld(), math.floor(BlockX / 16), math.floor(BlockZ / 16))
if (not IsInside) then
return true
end
end
function OnChunkGenerating(World, ChunkX, ChunkZ, ChunkDesc)
local IsInside = g_PosCheckIsInside(World, ChunkX, ChunkZ)
if (not IsInside) then
GenerateChunkOutOfRange(ChunkDesc) -- Generate the chunk as the user says we should generate it.
end
end
function OnPlayerMoving(Player)
if (Player:HasPermission("limitworld.bypass")) then
return false
end
local IsInside, NewPos = g_PosCheckIsInside(Player:GetWorld(), Player:GetChunkX(), Player:GetChunkZ())
if (IsInside) then
return false
end
-- Move the player slightly in the opposite direction.
local newPos = Player:GetPosition() - Player:GetSpeed()
Player:TeleportToCoords(newPos.x, newPos.y, newPos.z)
return true
end