Skip to content

Cheat Sheet

8Z edited this page Oct 10, 2023 · 4 revisions

A list of common things you may want to do with ArcCW and how to do them.

Check if a weapon is an ArcCW weapon

local wep = LocalPlayer():GetActiveWeapon()
print(wep.ArcCW == true)

Give a player an attachment

if SERVER then
  local ply = player.GetAll()[1]
  ArcCW:PlayerGiveAtt(ply, "my_attachment", 1)
  ArcCW:PlayerSendAttInv(ply) -- Networks attachment to client
end

Get the installed attachment name in a specific slot

local wep = LocalPlayer():GetActiveWeapon()
print(wep.Attachments[1].Installed) -- Attachment in first slot

Set attachment on a weapon

if SERVER then
  local wep = Entity(1):GetActiveWeapon()
  wep.Attachments[1].Installed = "optic_reddot"
  wep.Attachments[2].Installed = "muzz_compensator"
  wep:NetworkWeapon() -- Update attachment info for all clients
end

Override weapon stats through an external hook

For specifics, see this wiki page. Hooks must be in a shared realm!

-- Set Damage to 999 if user is admin
att.O_Hook_Override_Damage = function(wep, data)
  if IsValid(wep:GetOwner()) and wep:GetOwner():IsPlayer() and wep:GetOwner():IsAdmin() then
    return {current = 999}
  end
end