Skip to content

Instantly share code, notes, and snippets.

View ExtReMLapin's full-sized avatar
🤠
howdy

ExtReMLapin

🤠
howdy
  • Alphabet boys
  • Stacking up at your door
View GitHub Profile
hook.Add("Think", "MouseMove hook", function()
local x = gui.MouseX()
local y = gui.MouseY()
if x == 0 and y == 0 then return end -- cursor not enabled
if not gui.OldMouseX then -- first call
gui.OldMouseX = x;
gui.OldMouseY = y;
end
if ((gui.OldMouseY ~= y) or (gui.OldMouseX ~= x)) then
local phonArray = {}
phonArray["a"]="ALPHA";
phonArray["b"]="BRAVO";
phonArray["c"]="CHARLIE";
phonArray["d"]="DELTA";
phonArray["e"]="ECHO";
phonArray["f"]="FOXTROT";
phonArray["g"]="GOLF";
phonArray["h"]="HOTEL";
phonArray["i"]="INDIA";
@ExtReMLapin
ExtReMLapin / custom footstep by playermodel gmod.lua
Created September 4, 2018 16:16
custom footstep by playermodel gmod
if SERVER then return end
local data = {}
local function newplayermodelfootsteps(playermodel, material, tblsounds)
if not data[playermodel] then
data[playermodel] = {}
end
if not data[playermodel][material] then
local jigbones = {1,2,3,4,5,68,9,10,11, 59, 60, 61, 62,63, 64,65, 66, 67, 68,69,
13,14,15,16, } -- arms + torso + head
local ply = player.GetByID(1)
for i = 0, ply:GetBoneCount() - 1 do
ply:ManipulateBoneJiggle(i, table.HasValue(jigbones,i) and 1 or 0)
end
@ExtReMLapin
ExtReMLapin / sv_autosave.lua
Last active October 10, 2018 19:59
gmod auto prop save for multiplayer and singleplayer (no owned prop system like ffp)
local function saveentities()
local tbl = {}
local filepos = Format("_savefilemap_%s.txt", game.GetMap())
for k, v in pairs(ents.FindByClass("prop_physics")) do
if v:MapCreationID() != -1 then continue end
table.insert(tbl, {v:GetModel(), v:GetPos(), v:GetAngles(), v:GetMaterial()})
end
local tbltxt = util.TableToJSON(tbl)
file.Write(filepos,tbltxt)
@ExtReMLapin
ExtReMLapin / func_addr_lister.lua
Last active March 31, 2019 13:25
Generated a list of the addr of the _G functions, detect offset to fix the addr changing after a map change or a server reboot
function isFuncCPP(func)
return debug.getinfo(func).source == "=[C]"
end
function isFuncNative(func)
return string.StartWith(tostring(func),"function: builtin#")
end
function getFuncAddr(func)
if (type(func) != "function") then error("Expecting a function") end
class Program
{
private const double mu = 398600.4418;
private static void printDatasSats(double meanMotion, double excentricity)
{
double SemiMajorAxis = Math.Pow(mu / Math.Pow(meanMotion * (double)2 * Math.PI / 86400, (double)2), (double)((double)1 / (double)3));
double Apoapsis = (SemiMajorAxis * ((double)1 + excentricity)) - 6378.135;
double Periapsis = (SemiMajorAxis * ((double)1 - excentricity)) - 6378.135;
Console.WriteLine(string.Format("SemiMajorAxis = {0}\nApoapsis = {1}\nPeriapsis = {2}", SemiMajorAxis, Apoapsis, Periapsis));
@ExtReMLapin
ExtReMLapin / cl_realistic_view_angles.lua
Created July 22, 2019 09:54
gmod but with a realistic view angle
-- reference and calcs : https://i.imgur.com/G81PMSd.jpg
-- drop me in autorun/client/
local intensity = 1
local function cmtounit(cm)
return math.Remap(cm, 0, 173.736, 0, 96)
end
local cmDistanceUpPivot = 21.384 * intensity -- (cm)
local cmDistanceForwardPivot = 14.87 * intensity -- (cm)
@ExtReMLapin
ExtReMLapin / regex glua.txt
Last active August 24, 2019 21:44
regex lua hardcoded color
Color\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*\d+\s*)?\)
Vector\(\s*-?\d+(?:\.\d+)?\s*,\s*-?\d+(?:\.\d+)?\s*,\s*-?\d+(?:\.\d+)?\s*\)
Angle\(\s*-?\d+(?:\.\d+)?\s*,\s*-?\d+(?:\.\d+)?\s*,\s*-?\d+(?:\.\d+)?\s*\)
4ZWW/bE:1ZVyo[FG/bV:tMmCndC9<6
5[WX/cE;hdFHic1zoe2SteFjvRv?<6
4ZVW.bD:/dESfeEVsdEiuQu>;7
4ZVW.bD:/dESfeEVsdEiuQu>;7
5OSrEXBW0SxjCPCzJO.O3PSi1TBWxTDTIYB[1UC6.YBm;7
5[VX.cD;i\\UPwgVD.NlDmeB:;7
5[WX/cE;1[Vzo\\FH/\\VSteFjvRv?<6
4ZWW/bE:1ZVyo[FG/bV:tMmCndC9<6