[CHANGE] Can no longer kick or ban (or use the vote variants) on the listen server host.

This commit is contained in:
Nayruden 2017-01-05 18:25:43 -06:00
parent 120cb2c3dd
commit 592c8edbcd
4 changed files with 27 additions and 5 deletions

View File

@ -3,6 +3,7 @@
## v3.72 - *(00/00/00)*
* [CHANGE] UTeam is now disabled for DarkRP gamemodes to prevent conflicts (Thanks, Bo98).
* [CHANGE] "ulx bring" can now bring multiple targets (Thanks for the code, Timmy).
* [CHANGE] Can no longer kick or ban (or use the vote variants) on the listen server host.
* [FIX] More fixes for reading data from addon information (Thanks, Xylios).
* [FIX] Server error when autorefreshing some XGUI server files (Thanks, Yupi2).
* [FIX] Unexpected tags passed along in a log input (Thanks, mcNuggets1).

View File

@ -62,6 +62,11 @@ map:defaultAccess( ULib.ACCESS_ADMIN )
map:help( "Changes map and gamemode." )
function ulx.kick( calling_ply, target_ply, reason )
if target_ply:IsListenServerHost() then
ULib.tsayError( calling_ply, "This player is immune to kicking", true )
return
end
if reason and reason ~= "" then
ulx.fancyLogAdmin( calling_ply, "#A kicked #T (#s)", target_ply, reason )
else
@ -79,8 +84,8 @@ kick:help( "Kicks target." )
------------------------------ Ban ------------------------------
function ulx.ban( calling_ply, target_ply, minutes, reason )
if target_ply:IsBot() then
ULib.tsayError( calling_ply, "Cannot ban a bot", true )
if target_ply:IsListenServerHost() or target_ply:IsBot() then
ULib.tsayError( calling_ply, "This player is immune to banning", true )
return
end
@ -107,15 +112,21 @@ function ulx.banid( calling_ply, steamid, minutes, reason )
return
end
local name
local name, target_ply
local plys = player.GetAll()
for i=1, #plys do
if plys[ i ]:SteamID() == steamid then
name = plys[ i ]:Nick()
target_ply = plys[ i ]
name = target_ply:Nick()
break
end
end
if target_ply and (target_ply:IsListenServerHost() or target_ply:IsBot()) then
ULib.tsayError( calling_ply, "This player is immune to banning", true )
return
end
local time = "for #s"
if minutes == 0 then time = "permanently" end
local str = "#A banned steamid #s "

View File

@ -292,6 +292,11 @@ local function voteKickDone( t, target, time, ply, reason )
end
function ulx.votekick( calling_ply, target_ply, reason )
if target_ply:IsListenServerHost() then
ULib.tsayError( calling_ply, "This player is immune to kicking", true )
return
end
if ulx.voteInProgress then
ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true )
return
@ -367,6 +372,11 @@ local function voteBanDone( t, nick, steamid, time, ply, reason )
end
function ulx.voteban( calling_ply, target_ply, minutes, reason )
if target_ply:IsListenServerHost() or target_ply:IsBot() then
ULib.tsayError( calling_ply, "This player is immune to banning", true )
return
end
if ulx.voteInProgress then
ULib.tsayError( calling_ply, "There is already a vote in progress. Please wait for the current one to end.", true )
return

View File

@ -1 +1 @@
1483660695
1483662343