fix grapple

This commit is contained in:
Jonny_Bro (Nikita) 2023-05-27 19:28:08 +05:00
parent 6b85fea733
commit d80ccc84ec
5 changed files with 145 additions and 152 deletions

View file

@ -10,16 +10,16 @@ coursepanel.outlinecolor = Color(54, 55, 56)
coursepanel.alpha = 0.9
coursepanel.elements = {}
local function closebutton(self)
local function closebutton()
AEUI:Clear()
end
local function stopbutton(self)
local function stopbutton()
net.Start("Course_Stop")
net.SendToServer()
end
local function sacheck(self)
local function sacheck()
return not LocalPlayer():IsSuperAdmin()
end
@ -40,7 +40,7 @@ local courselist = {
elements = {}
}
function OpenCourseMenu(ply)
function OpenCourseMenu()
AEUI:AddPanel(coursepanel)
AEUI:AddPanel(courselist)

View file

@ -0,0 +1,115 @@
local gamemodePanel = {
w = 1200,
h = 650,
bgcolor = Color(32, 32, 32),
outlinecolor = Color(54, 55, 56),
alpha = 0.9,
elements = {}
}
gamemodePanel.x = 960 - gamemodePanel.w * 0.5
gamemodePanel.y = 540 - gamemodePanel.h * 0.5
local function closeButton()
AEUI:Clear()
end
local function infectionButton()
net.Start("Beatrun_ToggleInfection")
net.SendToServer()
end
local function datatheftButton()
net.Start("Beatrun_ToggleDataTheft")
net.SendToServer()
end
local loadoutnum = 1
local maxloadoutnum = 1
local function createButton()
net.Start("Beatrun_CreateLoadout")
net.SendToServer()
maxloadoutnum = maxloadoutnum + 1
LocalPlayer():EmitSound("buttonclick.wav")
end
local function resetloadoutButton()
net.Start("Beatrun_ResetLoadouts")
net.SendToServer()
loadoutnum = 1
maxloadoutnum = 1
LocalPlayer():EmitSound("buttonclick.wav")
end
local function leftButton()
if loadoutnum ~= 1 then
loadoutnum = loadoutnum - 1
LocalPlayer():EmitSound("buttonclick.wav")
end
end
local function rightButton()
if loadoutnum ~= maxloadoutnum then
loadoutnum = loadoutnum + 1
LocalPlayer():EmitSound("buttonclick.wav")
end
end
local function isSA()
return not LocalPlayer():IsSuperAdmin()
end
AEUI:AddText(gamemodePanel, "Gamemodes Select", "AEUIVeryLarge", 20, 30)
AEUI:AddButton(gamemodePanel, " X ", closeButton, "AEUILarge", gamemodePanel.w - 47, 0)
local infectionbutton = AEUI:AddButton(gamemodePanel, "Toggle Infection", infectionButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 550)
infectionbutton.greyed = isSA()
local datatheftbutton = AEUI:AddButton(gamemodePanel, "Toggle Data Theft", datatheftButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 450)
datatheftbutton.greyed = isSA()
-- local loadoutbutton = AEUI:AddButton(gamemodePanel, "Create a new loadout", createButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 450)
-- loadoutbutton.greyed = isSA()
-- local resetbutton = AEUI:AddButton(gamemodePanel, "Resets all loadouts", resetloadoutButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 550)
-- resetbutton.greyed = isSA()
-- local leftloadout = AEUI:AddButton(gamemodePanel, " < ", leftButton, "AEUILarge", gamemodePanel.w - 225, gamemodePanel.h - 175)
-- leftloadout.greyed = isSA()
-- local rightloadout = AEUI:AddButton(gamemodePanel, " > ", rightButton, "AEUILarge", gamemodePanel.w - 150, gamemodePanel.h - 175)
-- rightloadout.greyed = isSA()
-- AEUI:AddText(gamemodePanel, "Change through loadouts", "AEUILarge", gamemodePanel.w - 360, gamemodePanel.h - 125)
local weaponsList = {
w = 800,
h = 450,
x = 979.2 - gamemodePanel.w * 0.5,
y = 648 - gamemodePanel.h * 0.5,
bgcolor = Color(32, 32, 32),
outlinecolor = Color(54, 55, 56),
alpha = 0.9,
elements = {}
}
function OpenGMMenu(ply)
AEUI:AddPanel(gamemodePanel)
AEUI:AddPanel(weaponsList)
local loaded_weapons = {}
for i, _ in pairs(DATATHEFT_LOADOUTS) do
for _, v in pairs(DATATHEFT_LOADOUTS[i]) do
table.insert(loaded_weapons, v)
end
end
for _, v in pairs(weapons.GetList()) do
if not string.find(v.ClassName:lower(), "base") then
local weaponentry = AEUI:AddText(weaponsList, v.ClassName, "AEUILarge", 10, 40 * #weaponsList.elements)
function weaponentry:onclick()
LocalPlayer():EmitSound("buttonclick.wav")
end
weaponentry.greyed = isSA()
end
end
end
hook.Add("InitPostEntity", "GMMenuCommand", function()
concommand.Add("Beatrun_GamemodesMenu", OpenGMMenu)
hook.Remove("InitPostEntity", "GMMenuCommand")
end)
concommand.Add("Beatrun_GamemodesMenu", OpenGMMenu)

View file

@ -10,7 +10,7 @@ if CLIENT then
local activewep = ply:GetActiveWeapon()
if IsValid(activewep) and activewep:GetClass() ~= "runnerhands" then return end
if GetGlobalBool(GM_INFECTION) then return end
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) then return end
if not ply.GrappleHUD_tr then
ply.GrappleHUD_tr = {}
@ -53,7 +53,7 @@ local zpunchstart = Angle(2, 0, 0)
hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end
if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
if GetGlobalBool(GM_INFECTION) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end
local activewep = ply:GetActiveWeapon()
local usingrh = IsValid(activewep) and activewep:GetClass() == "runnerhands"

View file

@ -1,149 +1,5 @@
hook.Add("PlayerButtonDown", "GMMenuBind", function(ply, button)
if (game.SinglePlayer() or CLIENT and IsFirstTimePredicted()) and button == KEY_F3 then
ply:ConCommand("Beatrun_GMMenu")
ply:ConCommand("Beatrun_GamemodesMenu")
end
end)
if CLIENT then
local gamemodePanel = {
w = 1200,
h = 650
}
gamemodePanel.x = 960 - gamemodePanel.w * 0.5
gamemodePanel.y = 540 - gamemodePanel.h * 0.5
gamemodePanel.bgcolor = Color(32, 32, 32)
gamemodePanel.outlinecolor = Color(54, 55, 56)
gamemodePanel.alpha = 0.9
gamemodePanel.elements = {}
local function closeButton()
AEUI:Clear()
end
local function infectionButton()
net.Start("Beatrun_ToggleInfection")
net.SendToServer()
end
local function datatheftButton()
net.Start("Beatrun_ToggleDataTheft")
net.SendToServer()
end
local loadoutnum = 1
local maxloadoutnum = 1
local function createButton()
net.Start("Beatrun_CreateLoadout")
net.SendToServer()
maxloadoutnum = maxloadoutnum + 1
LocalPlayer():EmitSound("buttonclick.wav")
end
local function resetloadoutButton()
net.Start("Beatrun_ResetLoadouts")
net.SendToServer()
loadoutnum = 1
maxloadoutnum = 1
LocalPlayer():EmitSound("buttonclick.wav")
end
local function leftButton()
if loadoutnum ~= 1 then
loadoutnum = loadoutnum - 1
LocalPlayer():EmitSound("buttonclick.wav")
end
end
local function rightButton()
if loadoutnum ~= maxloadoutnum then
loadoutnum = loadoutnum + 1
LocalPlayer():EmitSound("buttonclick.wav")
end
end
local function isSA()
return not LocalPlayer():IsSuperAdmin()
end
AEUI:AddText(gamemodePanel, "Gamemodes Select", "AEUIVeryLarge", 20, 30)
AEUI:AddButton(gamemodePanel, " X ", closeButton, "AEUILarge", gamemodePanel.w - 47, 0)
local infectionbutton = AEUI:AddButton(gamemodePanel, "Toggle Infection", infectionButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 550)
infectionbutton.greyed = isSA()
local datatheftbutton = AEUI:AddButton(gamemodePanel, "Toggle Data Theft", datatheftButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 450)
datatheftbutton.greyed = isSA()
-- local loadoutbutton = AEUI:AddButton(gamemodePanel, "Create a new loadout", createButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 450)
-- loadoutbutton.greyed = isSA()
-- local resetbutton = AEUI:AddButton(gamemodePanel, "Resets all loadouts", resetloadoutButton, "AEUILarge", gamemodePanel.w - 330, gamemodePanel.h - 550)
-- resetbutton.greyed = isSA()
-- local leftloadout = AEUI:AddButton(gamemodePanel, " < ", leftButton, "AEUILarge", gamemodePanel.w - 225, gamemodePanel.h - 175)
-- leftloadout.greyed = isSA()
-- local rightloadout = AEUI:AddButton(gamemodePanel, " > ", rightButton, "AEUILarge", gamemodePanel.w - 150, gamemodePanel.h - 175)
-- rightloadout.greyed = isSA()
-- AEUI:AddText(gamemodePanel, "Change through loadouts", "AEUILarge", gamemodePanel.w - 360, gamemodePanel.h - 125)
local weaponsList = {
w = 800,
h = 450,
x = 979.2 - gamemodePanel.w * 0.5,
y = 648 - gamemodePanel.h * 0.5,
bgcolor = Color(32, 32, 32),
outlinecolor = Color(54, 55, 56),
alpha = 0.9,
elements = {}
}
function OpenGMMenu(ply)
AEUI:AddPanel(gamemodePanel)
AEUI:AddPanel(weaponsList)
for _, v in pairs(weapons.GetList()) do
if not string.find(v.ClassName:lower(), "base") then
local weaponentry = AEUI:AddText(weaponsList, v.ClassName, "AEUILarge", 10, 40 * #weaponsList.elements)
function weaponentry:onclick()
LocalPlayer():EmitSound("buttonclick.wav")
end
weaponentry.greyed = isSA()
end
end
end
hook.Add("InitPostEntity", "GMMenuCommand", function()
concommand.Add("Beatrun_GMMenu", OpenGMMenu)
hook.Remove("InitPostEntity", "GMMenuCommand")
end)
concommand.Add("Beatrun_GMMenu", OpenGMMenu)
end
if SERVER then
util.AddNetworkString("Beatrun_ToggleDataTheft")
util.AddNetworkString("Beatrun_ToggleInfection")
local datatheft, infection = false
net.Receive("Beatrun_ToggleDataTheft", function(_, ply)
datatheft = not datatheft
if datatheft then
Beatrun_StartDataTheft()
else
Beatrun_StopDataTheft()
end
end)
net.Receive("Beatrun_ToggleInfection", function(_, ply)
infection = not infection
if infection then
Beatrun_StartInfection()
else
Beatrun_StopInfection()
end
end)
end
end)

View file

@ -0,0 +1,22 @@
util.AddNetworkString("Beatrun_ToggleDataTheft")
util.AddNetworkString("Beatrun_ToggleInfection")
local datatheft, infection = false
net.Receive("Beatrun_ToggleDataTheft", function(_, ply)
datatheft = not datatheft
if datatheft then
Beatrun_StartDataTheft()
else
Beatrun_StopDataTheft()
end
end)
net.Receive("Beatrun_ToggleInfection", function(_, ply)
infection = not infection
if infection then
Beatrun_StartInfection()
else
Beatrun_StopInfection()
end
end)