-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsh_spawnpermissions.lua
52 lines (42 loc) · 2.04 KB
/
sh_spawnpermissions.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
-- The purpose of this module is to control spawn permissions via sAdmin, this is traditionally controlled from gProtect or the gamemode.
// _______ ___ _
// (_______) / __|_)
// _ ___ ____ _| |__ _ ____
// | | / _ \| _ (_ __) |/ _ |
// | |____| |_| | | | || | | ( (_| |
// \______)___/|_| |_||_| |_|\___ |
// (_____|
sAdmin.SpawnPermissions = sAdmin.SpawnPermissions or {Config = {}}
sAdmin.SpawnPermissions.Config.HookHostage = false -- If this is true it will return true if the player has the permission, this can override other hooks unless they are also returning a boolean.
-------------------------------------------------------------
slib.setLang("sadmin", "en", "spawnpermissions_category", "Spawn Permissions")
local ignoreHooks = { -- Theese are the hooks that can be controlled in sAdmin
"PlayerSpawnEffect",
"PlayerSpawnNPC",
"PlayerSpawnObject",
"PlayerSpawnProp",
"PlayerSpawnRagdoll",
"PlayerSpawnSENT",
"PlayerSpawnSWEP",
"PlayerSpawnVehicle"
}
for k,v in ipairs(ignoreHooks) do
sAdmin.registerPermission(v, slib.getLang("sadmin", sAdmin.config["language"], "spawnpermissions_category"))
hook.Add(v, "sA:SpawnPermissions", function(ply)
if !IsValid(ply) then return end
if !sAdmin.hasPermission(ply, v) then
sAdmin.msg(ply, "no_permission", v)
return false
elseif sAdmin.SpawnPermissions.Config.HookHostage then
return true
end
end)
end
slib.setLang("sadmin", "en", "PlayerSpawnEffect", "Spawn Effect")
slib.setLang("sadmin", "en", "PlayerSpawnNPC", "Spawn NPC")
slib.setLang("sadmin", "en", "PlayerSpawnObject", "Spawn Object")
slib.setLang("sadmin", "en", "PlayerSpawnProp", "Spawn Prop")
slib.setLang("sadmin", "en", "PlayerSpawnRagdoll", "Spawn Ragdoll")
slib.setLang("sadmin", "en", "PlayerSpawnSENT", "Spawn SENT")
slib.setLang("sadmin", "en", "PlayerSpawnSWEP", "Spawn SWEP")
slib.setLang("sadmin", "en", "PlayerSpawnVehicle", "Spawn Vehicle")