Upload Init hooks

This commit is contained in:
Ayase Minori 2024-08-19 12:39:35 +08:00 committed by GitHub
parent 41abeccd6c
commit 491b784661
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 163 additions and 0 deletions

5
prejoin_hooks/README.md Normal file
View file

@ -0,0 +1,5 @@
# How to use?
Drop this folder to your `lua/` folder and then set `lua_load_specific_files` to `prejoin_hooks/init.lua`.
This only works on Metastruct servers.

2
prejoin_hooks/init.lua Normal file
View file

@ -0,0 +1,2 @@
include("metastruct_specific/modules/pickup_hook.lua")
include("metastruct_specific/modules/use_hook.lua")

View file

@ -0,0 +1,31 @@
-- original code by Aoki (@aoki.me)
local prefixes = {
'/',
'!',
'.',
}
hook.Add( 'OnPlayerChat', 'pickuper', function( ply, message )
local usedPrefix = nil
for _, prefix in ipairs( prefixes ) do
if string.StartWith( message, prefix ) then
usedPrefix = prefix
break
end
end
if !usedPrefix then return end
local args = string.Explode( '%s+', string.sub( message, #usedPrefix + 1 ):lower(), true )
if args[1] == 'pickup' then
local target = easylua.FindEntity( args[2] )
if target != LocalPlayer() then return end
if !LocalPlayer():IsFriend( ply ) then return end
RunConsoleCommand( 'aowl', 'goto', ply:SteamID64() )
RunConsoleCommand( 'aowl', 'siton', ply:SteamID64() )
end
end)

View file

@ -0,0 +1,42 @@
include("metastruct_specific/util/use_hook_randomiser.lua")
include("metastruct_specific/util/tbl_utils.lua")
local lastTime = 0
local pokeCount = 0
local SPECIAL_UIDS = { 195868133, 48693720 }
local INPUT_COOLDOWN = false
hook.Add("PlayerUsedByPlayer", "touched", function(target, aimer)
if lastTime + 0.1 > CurTime() or INPUT_COOLDOWN then return end
lastTime= CurTime()
if pokeCount == 40 then
pokeCount = 0
INPUT_COOLDOWN = true
print(string.format("%s triggered the limit!", aimer))
-- check if player is in the UID list
if tbl_utils.contains(SPECIAL_UIDS, aimer:AccountID()) then
interactions.interact(aimer, true)
timer.Simple(4, function()
INPUT_COOLDOWN = false
end)
else
interactions.interact(aimer, false)
timer.Simple(4, function()
INPUT_COOLDOWN = false
end)
end
else
pokeCount = pokeCount + 1
RunConsoleCommand("actx", "poke")
if tbl_utils.contains(SPECIAL_UIDS, aimer:AccountID()) then
RunConsoleCommand("saysound", "hi honey++29")
else
RunConsoleCommand("saysound", "hi honey#1--25 hi honey#1++75:pitch(-1)")
end
end
end)

View file

@ -0,0 +1,11 @@
tbl_utils = {}
tbl_utils.contains = function (table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end

View file

@ -0,0 +1,72 @@
interactions = {
[1] = function(tp)
hook.Add("StartCommand", "impending_doom", function(ply, cmd)
local tgtAng = (tp:GetShootPos() - ply:GetShootPos()):GetNormalized():Angle()
cmd:SetViewAngles(tgtAng)
end)
timer.Simple(1.5, function()
RunConsoleCommand("actx", "shove")
RunConsoleCommand("hax", "nosound")
RunConsoleCommand("saysound", "you are hentai++40^999")
hook.Remove("StartCommand", "impending_doom")
end)
end,
[2] = function()
RunConsoleCommand("saysound", "i love you#5")
RunConsoleCommand("taunt", "IHeartYou")
end,
[3] = function()
RunConsoleCommand("actx", "disagree")
RunConsoleCommand("saysound", "you are horny")
end,
[4] = function(tp)
local amt = math.random(1, 10000)
SayLocal(":heart:")
SayLocal(string.format("!givecoins %s, %s", tp:GetName(), amt))
end,
[5] = function()
RunConsoleCommand("aowl", "killx", "1")
RunConsoleCommand("saysound", "kani:echo()^500")
timer.Simple(4, function()
RunConsoleCommand("aowl", "revive")
RunConsoleCommand("saysound", "oh my gah#2")
end)
end,
[6] = function(tp)
hook.Add("StartCommand", "impending_doom", function(ply, cmd)
local tgtAng = (tp:GetShootPos() - ply:GetShootPos()):GetNormalized():Angle()
cmd:SetViewAngles(tgtAng)
end)
RunConsoleCommand("taunt", "blow_kiss")
RunConsoleCommand("saysound", "elmo kiss")
timer.Simple(3, function()
hook.Remove("StartCommand", "impending_doom")
end)
end
}
interactions.interact = function(tp, isPlySpecial)
local rnd = math.random(#interactions)
local res = interactions[rnd]
if isPlySpecial then
while rnd % 2 ~= 0 do
rnd = math.random(#interactions)
res = interactions[rnd]
end
end
res(tp)
end