Files
2026-09-06 14:38:17 +02:00

37 lines
1.2 KiB
Lua

CreateConVar( "gc_allowbringplayers", 0, SERVER_CAN_EXECUTE, "Allow the !bring command to be used." )
cooldown = CreateConVar( "gc_bringcooldown", 120, {SERVER_CAN_EXECUTE, FCVAR_NEVER_AS_STRING}, "Sets the !bring cooldown (in seconds)." )
canbringplayers = true
forcebringdisable = false
function BringAllPlayers(ply)
if(canbringplayers) then
canbringplayers = false
timer.Simple(cooldown:GetInt(), function() canbringplayers = true end )
for k, v in pairs(player.GetAll()) do
if(ply != v) then
if(v:IsPlayer() && v:Alive()) then
v:SetPos(ply:GetPos())
end
end
end
end
end
hook.Add( "PlayerSay", "BringPlayersCommandSay", function( ply, text, public )
text = string.lower( text )
if ( text == "!bring" ) then
if((GetConVarNumber( "gc_allowbringplayers" ) != 0) && (forcebringdisable == false)) then
if(canbringplayers == false) then
ply:ChatPrint("You can use the !bring command only once every " .. cooldown:GetInt() .. " seconds!")
end
if(canbringplayers) then
for k, v in pairs(player.GetAll()) do
v:ChatPrint(ply:Nick() .. " has just used the !bring command!")
end
BringAllPlayers(ply)
end
end
return ""
end
end )