-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhooks.lua
134 lines (96 loc) · 3.13 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
function OnPlayerPlacingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ, BlockType)
if BlockFace == -1 then
return false
end
if Player:HasPermission("espawn.bypass") then
return false
end
WorldName = Player:GetWorld():GetName()
if IsInSpawn(BlockX, BlockY, BlockZ, WorldName) and PLACE == true then
Player:SendMessageInfo("Go further from spawn to build")
return true
end
return false
end
function OnPlayerBreakingBlock(Player, BlockX, BlockY, BlockZ, BlockFace, Status, BlockType, BlockMeta)
if BlockFace == -1 then
return false
end
if Player:HasPermission("espawn.bypass") then
return false
end
local WorldName = Player:GetWorld():GetName()
if IsInSpawn(BlockX, BlockY, BlockZ, WorldName) and BUILD == true then
Player:SendMessageInfo("Go further from spawn to build")
return true
end
return false
end
function OnExploding(World, ExplosionSize, CanCauseFire, X, Y, Z, Source, SourceData)
if IsInSpawn(X, Y, Z, World:GetName()) and EXPLODE == true then
return true
end
return false
end
function OnSpawningMonster(World, Monster)
if IsInSpawn(Monster:GetPosX(), Monster:GetPosY(), Monster:GetPosZ(), World:GetName()) and MOBSPAWNING == true then
return true
end
return false
end
function OnPlayerMoving(Player)
--Based on SpawnProtect too--
local WorldName = Player:GetWorld():GetName()
local X = Player:GetPosX()
local Y = Player:GetPosY()
local Z = Player:GetPosZ()
local playername = Player:GetName()
if PLAYERLOCATIONS[playername] ~= nil then
if not IsInSpawn(PLAYERLOCATIONS[playername]["x"], PLAYERLOCATIONS[playername]["y"], PLAYERLOCATIONS[playername]["z"], PLAYERLOCATIONS[playername]["world"]) then
if IsInSpawn(X, Y, Z, WorldName) then
if SPAWNMESSAGE == true then
Player:SendMessageInfo(messageenter)
end
end
else
if not IsInSpawn(X, Y, Z, WorldName) then
if SPAWNMESSAGE == true then
Player:SendMessageInfo(messageleave)
end
end
end
end
PLAYERLOCATIONS[playername] = {x = X, y = Y, z = Z, world = WorldName}
end
function OnTakeDamage(Receiver, TDI)
if TDI.Attacker == nil then
if TDI.DamageType == dtFalling and FALLDAMAGE == true then
if IsInSpawn(Receiver:GetPosX(), Receiver:GetPosY(), Receiver:GetPosZ(), Receiver:GetWorld():GetName()) and PVP == true then
return true
end
end
return false
end
if Receiver:IsPlayer() then
if TDI.Attacker:IsPlayer() then
if IsInSpawn(Receiver:GetPosX(), Receiver:GetPosY(), Receiver:GetPosZ(), Receiver:GetWorld():GetName()) and PVP == true then
return true
end
end
end
return false
end
function OnPlayerRightClick(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
if BlockFace == -1 then
return false
end
if Player:HasPermission("espawn.bypass") then
return false
end
local WorldName = Player:GetWorld():GetName()
if IsInSpawn(BlockX, BlockY, BlockZ, WorldName) and RIGHTCLICK == true then
Player:SendMessageInfo("Go further from spawn if you want to use your hand!")
return true
end
return false
end