mirror of
https://github.com/CFC-Servers/cfc_ulx_commands.git
synced 2025-03-04 03:13:28 -05:00
Add buildban (#145)
This commit is contained in:
parent
41dcbe3602
commit
5e44543e12
@ -10,7 +10,7 @@ Repo for CFC's custom ULX commands (that aren't separate)
|
||||
- [Falco's Prop Protection](https://github.com/FPtje/Falcos-Prop-protection) for `ulx forcebuddy`
|
||||
- Any CPPI system (such as [FPP](https://github.com/FPtje/Falcos-Prop-protection)) for commands that interact with player-spawned entities, such as `ulx freezeprops`
|
||||
- [Wiremod](https://github.com/wiremod/wire) and [StarfallEX](https://github.com/thegrb93/StarfallEx) for `ulx chipban`
|
||||
- `ulx pvpban` requires CFC's private pvp addon, and will silently remove itself without it
|
||||
- `ulx pvpban` and `ulx buildban` require CFC's private pvp addon, and will silently remove itself without it
|
||||
|
||||
## Curse Effect Config:
|
||||
A serverside config for curse effects can be made by creating `cfc_ulx_commands/curse/sv_config.json` in the server's `data/` folder.
|
||||
|
@ -35,6 +35,10 @@ AW.enabledCommands = {
|
||||
["ulx pvpban"] = { skipEmptyReason = true },
|
||||
["ulx pvpbanid"] = {},
|
||||
|
||||
-- BuildBan
|
||||
["ulx buildban"] = { skipEmptyReason = true },
|
||||
["ulx buildbanid"] = {},
|
||||
|
||||
-- Chipban
|
||||
["ulx chipban"] = { skipEmptyReason = true },
|
||||
["ulx chipbanid"] = {},
|
||||
|
34
lua/ulx/modules/sh/timed_build_ban.lua
Normal file
34
lua/ulx/modules/sh/timed_build_ban.lua
Normal file
@ -0,0 +1,34 @@
|
||||
if not CFCPvp then return end -- Command only exists when CFCPVP is on the server
|
||||
|
||||
CFCUlxCommands.buildban = CFCUlxCommands.buildban or {}
|
||||
local CATEGORY_NAME = "Utility"
|
||||
local PUNISHMENT = "buildban"
|
||||
local HELP = "Bans the target for a certain time from entering build"
|
||||
|
||||
|
||||
if SERVER then
|
||||
local function enable( ply )
|
||||
ply.isBuildBanned = true
|
||||
if ply:IsInBuild() then CFCPvp.setPlayerBuild( ply ) end
|
||||
end
|
||||
|
||||
local function disable( ply )
|
||||
ply.isBuildBanned = nil
|
||||
end
|
||||
|
||||
TimedPunishments.Register( PUNISHMENT, enable, disable )
|
||||
end
|
||||
|
||||
local action = "banned ## from Build"
|
||||
local inverseAction = "unbanned ## from Build"
|
||||
TimedPunishments.MakeULXCommands( PUNISHMENT, action, inverseAction, CATEGORY_NAME, HELP )
|
||||
|
||||
local function checkBuildBan( ply )
|
||||
if ply.isBuildBanned then
|
||||
ply:ChatPrint( "You cannot enter build because you're currently banned from build." )
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add( "CFC_PvP_PlayerWillExitPvp", "ULX_BuildBan_RestrictBuild", checkBuildBan )
|
||||
|
Loading…
Reference in New Issue
Block a user