Giter Site home page Giter Site logo

gmod-utils's Introduction

TAServers GMod Utils

Initialisation scripts and other utilities for the TAServers GMod server.

Contributing

Create a file for your utility in the appropriate realm's folder (e.g. sv-tas-utils). If your code is using functions etc. from other addons, or anything from TASUtils, you should place it in initpostentity

Any utility functions you want used globally, place in the TASUtils global table to keep everything together, an example being TASUtils.Broadcast. If it's not obvious what the function does, add a comment documenting it.

gmod-utils's People

Contributors

derpius avatar adamnejm avatar zubbbz avatar yogwoggf avatar kilometres avatar vurv78 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

adamnejm

gmod-utils's Issues

Simple block sounds

Just to prevent minges doing mingy things

local blacklist = {
	gmod_thruster = true,
	gmod_wire_thruster = true,
	gmod_wire_vectorthruster = true,
	gmod_wire_painter = true,
}

hook.Add("EntityEmitSound", "psb_sounds", function(data)
	if blacklist[data.Entity:GetClass()] then return false end
end)

Rework ULX cleanup commands

Rework:

  • Move them into a separate "Cleanup" category, putting everything into TAS Utilities is stupid.
  • Export a function from every file, then make ulx tidy that will just call all of them

Add ropes cleanup

if SERVER then
	function ulx.ropes(ply)
		for k,v in pairs(ents.FindByClass("keyframe_rope")) do
			if v.Ent1 and v.Ent1:IsWorld() and v.Ent2 and v.Ent2:IsWorld() then v:Remove() end
		end
		
		ulx.fancyLogAdmin(ply, "#A removed all the world ropes")
	end
end

local cmd = ulx.command("Cleanup", "ulx ropes", ulx.ropes, "!ropes")
cmd:defaultAccess(ULib.ACCESS_ADMIN)
cmd:help("Removes all the world ropes")

Add uptime

local time = SysTime
local tostr = tostring

if SERVER then
	local boot = time() or 0
	
	function ulx.uptime(calling_ply, target_plys, amount)
		local diff = time() - boot
		if not diff then return end
		
		local up = string.FormattedTime(diff)
		local msg = up and string.format("%02i:%02i:%02i", tostr(up.h), tostr(up.m), tostr(up.s)) or "who knows how many hours"
		
		ulx.fancyLog("Server has been running for #s", msg)
	end
end

local cmd = ulx.command("Utility", "ulx uptime", ulx.uptime, "!uptime", true)
cmd:defaultAccess(ULib.ACCESS_ADMIN)
cmd:help("Server's uptime")

Make minge rank

local function block(ply)
	if IsValid(ply) and ply:GetUserGroup() == "minge" then return false end
end

hook.Add("ULibCommandCalled", "psb_bastard", block)
hook.Add("PlayerSpawnEffect", "psb_bastard", block)
hook.Add("PlayerSpawnNPC", "psb_bastard", block)
hook.Add("PlayerSpawnObject", "psb_bastard", block)
hook.Add("PlayerSpawnProp", "psb_bastard", block)
hook.Add("PlayerSpawnRagdoll", "psb_bastard", block)
hook.Add("PlayerSpawnSENT", "psb_bastard", block)
hook.Add("PlayerSpawnSWEP", "psb_bastard", block)
hook.Add("PlayerSpawnVehicle", "psb_bastard", block)
hook.Add("PlayerNoClip", "psb_bastard", block)
hook.Add("PhysgunPickup", "psb_bastard", block)
hook.Add("CanPlayerUnfreeze", "psb_bastard", block)
hook.Add("CanPlayerEnterVehicle", "psb_bastard", block)
hook.Add("CanPlayerSuicide", "psb_bastard", block)
hook.Add("PlayerGiveSWEP", "psb_bastard", block)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.