Forked from https://forums.alliedmods.net/showthread.php?p=2129213