-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix.lua
More file actions
41 lines (33 loc) · 1.05 KB
/
Copy pathfix.lua
File metadata and controls
41 lines (33 loc) · 1.05 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
--[[
@author Knax
]]
local spawnCount = {}
local antiParachuteEnabled = true
AddEventHandler("entityCreating", function(entity)
if not antiParachuteEnabled then return end
if GetEntityModel(entity) ~= 1336576410 then return end
local owner = NetworkGetFirstEntityOwner(entity)
if not owner or owner <= 0 then return end
local count = (spawnCount[owner] or 0) + 1
spawnCount[owner] = count
if count == 1 then
SetTimeout(5 * 1000, function()
spawnCount[owner] = nil
end)
end
if count > 1 then
CancelEvent()
print(("Player ^3%s^0 (^3%s^0) spawned too many parachutes.")
:format(GetPlayerName(owner), owner))
-- You also could ban or kick the player
end
end)
RegisterCommand("disableParachute", function(source)
if source ~= 0 then return end
antiParachuteEnabled = not antiParachuteEnabled
print(antiParachuteEnabled and "enabled" or "disabled")
end)
AddEventHandler("playerDropped", function()
local src = source
spawnCount[src] = nil
end)