Accepted RMT Equipment Edits

InGame

New member
Dec 2, 2024
23
2
3
Title - Suggestion - RMT Equipment Edits

OOC Name:
Your In-Game Name / Position:
Suggestion:

- Alter the Disguise SWEP to be more User Friendy/Useful
  • Cut-out lua bloat
  • Changed UI to a 2d Derma Panel, functionality exists I'll make it look pretty by the time the forums open for suggestions
  • Added Player NoTarget on Disguise
- Change the Cloak to more little more sense!
  • Add Uncloak on Any Weapon Attack
  • Disable Drawing of All Held Weapons

How will your suggestion benefit the server:
Disguise SWEP atm literally useless and dogshit UI, NoTarget makes infiltration possible.
Cloak is nearly there but needs balancing, uncloak on hit makes it so we cant just kunai/electrostaff hit on cloak. Worldmodel no draw makes it so we dont have a floating pod when cloaked!!

Have you consulted any regimental command that this change may affect? (if yes say who):
NAW

Applicable Addon/Model Link:
CLOAK

Code:
AddCSLuaFile()
SWEP.Spawnable = true
SWEP.Base = "weapon_salt_base"

SWEP.ViewModel = "models/weapons/c_arms.mdl"
SWEP.WorldModel = "models/scotty/weapons/personal_cloak.mdl"
SWEP.PrintName = "Personal Cloaking Device"
SWEP.HoldType = "normal"
SWEP.Category = "Scottys Armoury"
SWEP.Instructions = [[
Left Click = Cloak
]]
SWEP.Description = [[
This is an advanced prototype of a Personal Cloaking Device.

It NoTargets you to NPC's, renders you completely invisible to any other player, hides your name, shadow, walking sound ETC.
If you take any type of damage, you will be knocked out of cloak with a noticable bang.
Shooting a weapon or activating a flashlight will instantly take you out of cloak.
You can melee, physgun, toss stuff and sprint while cloaked without being decloaked.
]]

if CLIENT then
    SWEP.WepSelectIcon = surface.GetTextureID("weapons/swep")
end

local lastcloak = 0
local CV_USETIMER = CreateConVar("salta_weapons_cloacker_usetimer","0",FCVAR_REPLICATED)
local CV_TIMER = CreateConVar("salta_weapons_cloacker_timer","480",FCVAR_REPLICATED)

SWEP.WeaponColor = Color(100,0,100)
SWEP.UsesWeaponColor = true

SWEP.Primary.Ammo = "none"
SWEP.Primary.Delay = 4
SWEP.Primary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.Delay = 4
SWEP.Secondary.Automatic = false

function SWEP:Init()
    self:SetNWInt("cloaking",0)
end

function SWEP:Reload()
end

function CCloakPlayer(ply)
    if SERVER then
        if not ply:FlashlightIsOn() then
            ply:SetNWBool("salt_cloaked",true)
            local pos = ply:GetPos()+ply:OBBCenter()
            local efd = EffectData()
            efd:SetStart(pos)
            efd:SetColor(0)
            util.Effect("salt_cloaked",efd,true,true)
            ply:SetNoDraw(true)
            ply:SetNoTarget(true)
            ply:DrawWorldModel(false)
            ply:ChatPrint("You are now cloaked.")
        else
            ply:ChatPrint("Can not cloak flashlight is on.")
        end
        ply:SetNWInt("cloaking",0)
    end
end

function DCloakPlayer(ply,i,bad)
    ply:SetNWBool("salt_cloaked",false)
    if SERVER then
        local pos = ply:GetPos()+ply:OBBCenter()
        local efd = EffectData()
        efd:SetStart(pos)
        efd:SetColor(1)
        if bad then
            efd:SetColor(-1)
            sound.Play("ambient/levels/citadel/portal_beam_shoot6.wav",pos,100,255)
        end
        util.Effect("salt_cloaked",efd,true,true)
        ply:SetNoDraw(false)
        ply:SetNoTarget(false)
        ply:DrawWorldModel(true)
        ply:ChatPrint("You are no longer cloaked.")
        ply:SetNWInt("cloaking",0)
        i = i or false
        ply.cloakd = i
    end
end

function SWEP:PrimaryAttack()
    if IsFirstTimePredicted() then
        local own = self.Owner
        if not own:GetNWBool("salt_cloaked",false) then
            lastcloak = CurTime()+CV_TIMER:GetFloat()
            own:SetNWInt("cloaktime",CurTime()+4)
            own:SetNWInt("cloaking",1)
            self:EmitSound("scotty/cloakfast.wav",60,100,.7)
        else
            own:SetNWInt("cloaktime",CurTime()+4)
            own:SetNWInt("cloaking",2)
            self:EmitSound("scotty/decloakfast.wav",60,100,.7)
        end
    end
    self:DoNextFire()
end

function SWEP:SecondaryAttack()
end

if SERVER then
    hook.Add("PlayerDeath","salt_PlayerDeath_cloaker",function(ply)
        if ply:GetNWBool("salt_cloaked",false) then
            DCloakPlayer(ply,false,true)
        end
    end)
    hook.Add("PlayerSilentDeath","salt_PlayerSilentDeath_cloaker",function(ply)
        if ply:GetNWBool("salt_cloaked",false) then
            DCloakPlayer(ply,false,true)
        end
    end)
    hook.Add("EntityTakeDamage","salt_EntityTakeDamage_cloaker",function(ply)
        if IsValid(ply) and ply:IsPlayer() and ply:GetNWBool("salt_cloaked",false) then
            DCloakPlayer(ply,false,true)
        end
    end)
    hook.Add("EntityFireBullets","salt_EntityFireBullets_cloaker",function(ent)
        if IsValid(ent) and ent:IsPlayer() and ent:GetNWBool("salt_cloaked",false) then
            DCloakPlayer(ent,false,true)
        end
    end)
    hook.Add("StartCommand","salt_StartCommand_cloaker",function(ply,cmd)
        if CurTime() > ply:GetNWInt("cloaktime",math.huge) and ply:GetNWInt("cloaking",0) == 1 then
            CCloakPlayer(ply)
        elseif CurTime() > ply:GetNWInt("cloaktime",math.huge) and ply:GetNWInt("cloaking",0) == 2 then
            DCloakPlayer(ply)
        end
        local und = false
        local wep = ply:GetActiveWeapon()
        if ply:GetNWBool("salt_cloaked",false) and ply:FlashlightIsOn() then
            und = true
        end
        if ply:GetNWBool("salt_cloaked",false) then
            ply:SetNoDraw(true)
            ply:SetNoTarget(true)
        end
        if ply.cloakd == true or und then
            ply.cloakd = false
            DCloakPlayer(ply,1)
        end
    end)
    hook.Add("KeyPress", "PlayerAttackCheckington", function(ply, key)
        if (ply:GetNWBool("salt_cloaked", false) and key == IN_ATTACK) then -- false means cloaked??
            ply.cloakd = false
            DCloakPlayer(ply, 1)
        end
    end)
else
    local olddti = GAMEMODE.HUDDrawTargetID
    function GAMEMODE:HUDDrawTargetID()
        local tr = LocalPlayer():GetEyeTrace().Entity
        if IsValid(tr) and tr:IsPlayer() then
            if not tr:GetNWBool("salt_cloaked",false) then
                olddti(GAMEMODE)
            end
        end
    end
    hook.Add("DrawPhysgunBeam","salt_DrawPhysgunBeam_cloaker",function(ply)
        if ply:GetNWBool("salt_cloaked",false) then
            if ply == LocalPlayer() then
                if ply:ShouldDrawLocalPlayer() then
                    return false
                end
            else
                return false
            end
        end
    end)
end

hook.Add("PlayerFootstep","salt_PlayerFootstep",function(ply)
    if ply:GetNWBool("salt_cloaked",false) then
        return true
    end
end)

local colr = Color(255,255,255)
hook.Add("HUDPaint","salt_HUDPaint_cloaker",function()
    local lply = LocalPlayer()
    local v = 120 + math.abs(math.sin(CurTime()*2 %360))*100
    colr.r = v
    colr.g = v
    colr.b = v
    if lply:GetNWInt("cloaking",0) == 1 then
        draw.SimpleTextOutlined("You are cloaking...","DermaLarge",ScrW()/2,ScrH()-64,colr,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP,1,color_black)
    elseif lply:GetNWInt("cloaking",0) == 2 then
        draw.SimpleTextOutlined("You are decloaking...","DermaLarge",ScrW()/2,ScrH()-64,colr,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP,1,color_black)
    else
        if lply:GetNWBool("salt_cloaked",false) then
            draw.SimpleTextOutlined("You are cloaked","DermaLarge",ScrW()/2,ScrH()-64,colr,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP,1,color_black)
            if CV_USETIMER:GetBool() then
                draw.SimpleTextOutlined("Time left ()","DermaLarge",ScrW()/2,ScrH()-64-32,colr,TEXT_ALIGN_CENTER,TEXT_ALIGN_TOP,1,color_black)
            end
        end
    end
end)

DISGUISE SWEP
Code:
AddCSLuaFile()
CreateConVar("disguise_swep_time", 60, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "")

if SERVER then
    util.AddNetworkString("use_agentweapon")

    -- Handle disguise logic on selection
    net.Receive("use_agentweapon", function(len, ply)
        if not IsValid(ply) then return end
        if ply:GetActiveWeapon():GetClass() ~= "weapon_agent" then return end
        local num = net.ReadFloat()
        local model
        local old = ply:GetModel()

        if type(RPExtraTeams[num].model) == "table" then
            model = RPExtraTeams[num].model[1]
        else
            model = RPExtraTeams[num].model
        end

        if model == nil then return end

        ply:GetActiveWeapon():SendWeaponAnim(ACT_VM_PRIMARYATTACK)
        ply:Freeze(true)

        timer.Simple(4.4, function()
            if IsValid(ply) then
                ply:SetModel(model)
                ply:SetNWBool("istransformed", true)
                ply:SetNoTarget(true)
                ply:Freeze(false)

                ply:StripWeapon("weapon_agent")

                timer.Simple(GetConVar("disguise_swep_time"):GetFloat(), function()
                    if ply:GetNWBool("istransformed") == false then return end

                    ply:Freeze(true)

                    timer.Simple(4.4, function()
                        ply:SetModel(old)
                        ply:SetNWBool("istransformed", false)
                        ply:Give("weapon_agent")
                        ply:SetNoTarget(false)
                        ply:Freeze(false)
                    end)
                end)
            end
        end)
    end)
end

SWEP.PrintName = "Advanced Disguise Swep"
SWEP.Author = "g_o_r_k_e_m, Edited by InGame"
SWEP.Instructions = "Use this tool to disguise as any job you want"
SWEP.Spawnable = true
SWEP.Category = "Gorkem"

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"

SWEP.HoldType = "normal"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.UseHands = false
SWEP.ViewModel = "models/weapons/v_c4.mdl"
SWEP.WorldModel = ""
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = false

function SWEP:SetHoldType()
    self:SetHoldType(self.HoldType)
end

function SWEP:PrimaryAttack()
    if CLIENT then
        self:OpenDisguiseUI()
    end
end

if CLIENT then
    function SWEP:OpenDisguiseUI()
        local frame = vgui.Create("DFrame")
        frame:SetSize(ScrW() * 0.5, ScrH() * 0.75)
        frame:Center()
        frame:SetTitle("Select a Job")
        frame:MakePopup()
    
        local scrollPanel = vgui.Create("DScrollPanel", frame)
        scrollPanel:Dock(FILL)
    
        local jobsByCategory = {}
    
        for num, teamData in pairs(RPExtraTeams) do
            local category = teamData.category or "Uncategorized"
            if not jobsByCategory[category] then
                jobsByCategory[category] = {}
            end
            table.insert(jobsByCategory[category], {num, teamData})
        end
    
        for category, jobs in pairs(jobsByCategory) do
            local categoryHeader = vgui.Create("DLabel", scrollPanel)
            categoryHeader:SetText(category)
            categoryHeader:SetFont("DermaLarge")
            categoryHeader:Dock(TOP)
            categoryHeader:DockMargin(0, 10, 0, 5)
    
            for _, jobData in ipairs(jobs) do
                local num, teamData = jobData[1], jobData[2]
                local button = vgui.Create("DButton", scrollPanel)
                button:Dock(TOP)
                button:DockMargin(0, 0, 0, 5)
                button:SetText(teamData.name)
                button:SetColor(teamData.color)
                button:SetSize(scrollPanel:GetWide() * 0.9, 40)
    
                button.DoClick = function()
                    net.Start("use_agentweapon")
                    net.WriteFloat(num)
                    net.SendToServer()
                    frame:Close()
                end
    
                local modelPanel = vgui.Create("DModelPanel", button)
                modelPanel:SetSize(64, 64)
                modelPanel:SetModel(type(teamData.model) == "table" and teamData.model[1] or teamData.model)
                modelPanel:SetCamPos(Vector(20, 20, 50))
                modelPanel:SetLookAt(Vector(0, 0, 45))
                modelPanel:SetParent(button)
                modelPanel:Dock(LEFT)
            end
        end
    end
    
end


Anything else:
 
50-4c332bdf90fa7acb4599ecdb9de236e0.jpg


This suggestion has been ACCEPTED.

Any Questions, contact myself or any members of Management!
Management Team