A few TTT server problems: damgelogs / ulx / pointshop / custom weapons

Sorry, I always suck at placing threads in the right sub-forum whenever I join a new one d:

Anyway, he’s the OP:

Hi!

My friends started a server a couple of days ago. They put me in charge of the website and server settings/addons, because reasons.

Anyway, after much derpping, I was finally able to get the server running with your basic admin tools.

Yet, I’ve come across some problems I can’t seem to find answers for. My Googling powers aren’t strong enough, apparently.

If anyone would like to help me out, great!

[HR][/HR]

The first is letting custom groups view the RDM Manager. I’ve been digging around the internet and can’t find anything close to what I’m looking for.
I’ve created a few custom groups, like “Donor” and “Moderator.” I would like some custom staff groups to be able to view the RDM Manager for the TTT Damagelogs; however, I’m simply lost. No luck making it so “Moderator” and other such custom groups can view the RDM Manager.
I assume there’s a .txt or .lua file I have to edit, but I don’t know which one!

Another ULX problem I’m having is allowing custom groups to target multiple groups. For example, I want “Moderator” to be able to target what I deem lower ranks, but not higher ranks. Do I have to order the groups in the .txt file and use the !% prefix or something? Halp.

Moving on to pointshop problems:
I’ve made a couple of custom weapons to add to the pointshop. I added a modified pistol, a modified sniper rifle and someone else’s AWP.lua.
The AWP works like it should: buying the weapon equips it.
Then there’s the modified pistol. It works, but it gives the player two primary weapons. Players can buy the AWP and the modified pistol (that I set to be a primary weapon). They can also buy the modified pistol and pick up another primary weapon like the MAC10 or shotgun.
I have no idea why it occurs. My only guess is that the “pistol” mentions in the .lua is the issue.Can you simply not have pistols in the primary weapon slot?
Here’s the pointshop and weapon .lua’s:


ITEM.Name = 'Teh Troll'
ITEM.Price = 200
ITEM.Model = 'models/weapons/w_pist_fiveseven.mdl'
ITEM.WeaponClass = 'weapon_ps_troll'
ITEM.SingleUse = true

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end


AddCSLuaFile()
 
SWEP.HoldType = "pistol"
   

if CLIENT then
   SWEP.PrintName = "Teh Troll"
   SWEP.Slot = 2

   SWEP.Icon = "vgui/ttt/icon_pistol"
end

SWEP.Kind = WEAPON_PISTOL
SWEP.WeaponID = AMMO_PISTOL

SWEP.Base = "weapon_tttbase"
SWEP.Primary.Ammo = "Buckshot"
SWEP.Primary.Recoil	= 2.3
SWEP.Primary.Damage = 5
SWEP.Primary.Delay = 0.12
SWEP.Primary.Cone = 0.02
SWEP.Primary.ClipSize = 5
SWEP.Primary.Automatic = true
SWEP.Primary.NumShots = 7
SWEP.Primary.DefaultClip = 5
SWEP.Primary.ClipMax = 20
SWEP.Primary.Ammo = "Pistol"
SWEP.AutoSpawnable = false
SWEP.AmmoEnt = "item_ammo_pistol_ttt"

SWEP.UseHands			= true
SWEP.ViewModelFlip		= false
SWEP.ViewModelFOV		= 54
SWEP.ViewModel  = "models/weapons/cstrike/c_pist_fiveseven.mdl"
SWEP.WorldModel = "models/weapons/w_pist_fiveseven.mdl"

SWEP.Primary.Sound = Sound( ")weapons/scout/scout_fire-1.wav" )
SWEP.IronSightsPos = Vector(-5.95, -4, 2.799)
SWEP.IronSightsAng = Vector(0, 0, 0)

Here’s the AWP, which functions perfectly fine:


ITEM.Name = 'Silent AWP'
ITEM.Price = 250
ITEM.Model = 'models/weapons/w_snip_awp.mdl'
ITEM.WeaponClass = 'weapon_ps_awp'
ITEM.SingleUse = true

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end


SWEP.HoldType           = "slam"

if CLIENT then
   SWEP.PrintName          = "Silent AWP"

   SWEP.Slot               = 2

   SWEP.Icon = "VGUI/ttt/icon_scout"
   
end

SWEP.Base               = "weapon_tttbase"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Kind = WEAPON_HEAVY
SWEP.WeaponID = AMMO_SAWP
SWEP.IsSilent = true
SWEP.Primary.Delay          = 1.5
SWEP.Primary.Recoil         = 7
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "357"
SWEP.Primary.Damage = 50
SWEP.Primary.Cone = 0.005
SWEP.Primary.ClipSize = 10
SWEP.Primary.ClipMax = 20 -- keep mirrored to ammo
SWEP.Primary.DefaultClip = 10
SWEP.HeadshotMultiplier = 4
SWEP.AutoSpawnable      = true
SWEP.AmmoEnt = "item_ammo_357_ttt"
SWEP.ViewModel          = Model("models/weapons/v_snip_awp.mdl")
SWEP.WorldModel         = Model("models/weapons/w_snip_awp.mdl")
SWEP.Primary.Sound = Sound ("Weapon_M4A1.Silenced")

SWEP.Secondary.Sound = Sound("Default.Zoom")
SWEP.IronSightsPos      = Vector( 5, -15, -2 )
SWEP.IronSightsAng      = Vector( 2.6, 1.37, 3.5 )

function SWEP:SetZoom(state)
    if CLIENT then 
       return
    else
       if state then
          self.Owner:SetFOV(20, 0.3)
       else
          self.Owner:SetFOV(0, 0.2)
       end
    end
end

-- Add some zoom to ironsights for this gun
function SWEP:SecondaryAttack()
    if not self.IronSightsPos then return end
    if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
    
    bIronsights = not self:GetIronsights()
    
    self:SetIronsights( bIronsights )
    
    if SERVER then
        self:SetZoom(bIronsights)
     else
        self:EmitSound(self.Secondary.Sound)
    end
    
    self.Weapon:SetNextSecondaryFire( CurTime() + 0.3)
end

function SWEP:PreDrop()
    self:SetZoom(false)
    self:SetIronsights(false)
    return self.BaseClass.PreDrop(self)
end

function SWEP:Reload()
    self.Weapon:DefaultReload( ACT_VM_RELOAD );
    self:SetIronsights( false )
    self:SetZoom(false)
end


function SWEP:Holster()
    self:SetIronsights(false)
    self:SetZoom(false)
    return true
end

if CLIENT then
   local scope = surface.GetTextureID("sprites/scope")
   function SWEP:DrawHUD()
      if self:GetIronsights() then
         surface.SetDrawColor( 0, 0, 0, 255 )
         
         local x = ScrW() / 2.0
         local y = ScrH() / 2.0
         local scope_size = ScrH()

         -- crosshair
         local gap = 80
         local length = scope_size
         surface.DrawLine( x - length, y, x - gap, y )
         surface.DrawLine( x + length, y, x + gap, y )
         surface.DrawLine( x, y - length, x, y - gap )
         surface.DrawLine( x, y + length, x, y + gap )

         gap = 0
         length = 50
         surface.DrawLine( x - length, y, x - gap, y )
         surface.DrawLine( x + length, y, x + gap, y )
         surface.DrawLine( x, y - length, x, y - gap )
         surface.DrawLine( x, y + length, x, y + gap )


         -- cover edges
         local sh = scope_size / 2
         local w = (x - sh) + 2
         surface.DrawRect(0, 0, w, scope_size)
         surface.DrawRect(x + sh - 2, 0, w, scope_size)

         surface.SetDrawColor(255, 0, 0, 255)
         surface.DrawLine(x, y, x + 1, y + 1)

         -- scope
         surface.SetTexture(scope)
         surface.SetDrawColor(255, 255, 255, 255)

         surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)

      else
         return self.BaseClass.DrawHUD(self)
      end
   end

   function SWEP:AdjustMouseSensitivity()
      return (self:GetIronsights() and 0.2) or nil
   end
end

The pointshop .lua’s work fine, they do what they should.
However, the modified pistol says it’s in slot 3 in-game, but you can still pick up another slot 3 weapon. Agh!

And then there’s the modified sniper, which doesn’t work at all. Doesn’t equip, nothin’. It gives the “bought” message, but doesn’t equip the weapon!


ITEM.Name = 'The NoScope'
ITEM.Price = 300
ITEM.Model = 'models/weapons/w_snip_scout.mdl'
ITEM.WeaponClass = 'weapon_ps_noscope'
ITEM.SingleUse = true

function ITEM:OnBuy(ply)
	ply:Give(self.WeaponClass)
	ply:SelectWeapon(self.WeaponClass)
end

function ITEM:OnSell(ply)
	ply:StripWeapon(self.WeaponClass)
end


AddCSLuaFile()

SWEP.HoldType			= "ar2"

if CLIENT then
   SWEP.PrintName			= "The NoScope"
   SWEP.Slot				= 2

   SWEP.Icon = "vgui/ttt/icon_scout"
end

SWEP.Base				= "weapon_tttbase"
SWEP.Spawnable = true

SWEP.Kind = WEAPON_HEAVY
SWEP.WeaponID = AMMO_RIFLE

SWEP.Primary.Delay			= 1.5
SWEP.Primary.Recoil			= 10
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "357"
SWEP.Primary.Damage = 200
SWEP.Primary.Cone = 0.001
SWEP.Primary.ClipSize = 1
SWEP.Primary.ClipMax = 3
SWEP.Primary.DefaultClip = 3
SWEP.AutoSpawnable      = true
SWEP.AmmoEnt = "item_ammo_357_ttt"

SWEP.HeadshotMultiplier = 1

SWEP.UseHands			= true
SWEP.ViewModelFlip		= false
SWEP.ViewModelFOV		= 64
SWEP.ViewModel			= "models/weapons/cstrike/c_snip_scout.mdl"
SWEP.WorldModel			= "models/weapons/w_snip_scout.mdl"

SWEP.Primary.Sound = Sound( ")weapons/scout/scout_fire-1.wav" )
   if not self.IronSightsPos then return end
   if self:GetNextSecondaryFire() > CurTime() then return end

   local bIronsights = not self:GetIronsights()

   self:SetIronsights( bIronsights )

   if SERVER then
      self:SetZoom( bIronsights )
   end

   self:SetNextSecondaryFire( CurTime() + 0.3 )
end

function SWEP:PreDrop()
   self:SetZoom(false)
   self:SetIronsights(false)
   return self.BaseClass.PreDrop(self)
end

function SWEP:Reload()
    if (self:Clip1() == self.Primary.ClipSize or
        self.Owner:GetAmmoCount(self.Primary.Ammo) <= 0) then
       return
    end
    self:DefaultReload(ACT_VM_RELOAD)
    self:SetIronsights(false)
    self:SetZoom(false)
end

function SWEP:Holster()
   self:SetIronsights(false)
   self:SetZoom(false)
   return true
end

What did I mess up? Also, I once replaced the default snipers with the modified one, and it had the same equip problem as the modified pistol: it let you equip another slot 3 weapon at the same time.
It’s really frustrating xP

Any help with these issues is welcome.

Go into lua/damagelogs/config/config.lua and the options to change the ranks etc are there (assuming you’re using tommy’s damagelogs/RDM manager). For the ULX issue, you want to go into the ‘Manage Groups’ section and then put into the moderator rank !%admin so it can’t target admin or any inheriting ranks. For your final issue, open the modified pistol file and change SWEP.Slot = 2 to SWEP.Slot = 1 (gmod for some reason adds 1 to whatever slot you put down so if you say slot 2, I’ll go in slot 3 etc.) For future reference, try to be more consice about your issues and just tell us what we need to know. It means you’ll be more likely to get help and at a quicker speed.

Thanks for the reply.

However, the intention of the modified pistol is to be a primary weapon. Which is why it’s set to Slot = 2.
The issue is: it allows the user to equip two primary weapons. Both the modified pistol, another primary (shotgun, M16, etc.) and a secondary.
I have no idea what’s causing the issue. At the time of writing this, I’m going back to start the .lua from scratch and see if I happen to replicate the issue again =/

UPDATE
I’ve since figured out why the pistol was stacking on top of other weapons.
The issue was in SWEP.KIND being set to WEAPON_PISTOL. After I set my modified pistol to SWEP.KIND = WEAPON_HEAVY I was able to equip it without being able to pick up other primary weapons. I guess SWEP.Kind and SWEP.Slot conflict with each other.
I also fixed my modified sniper by re-creating it from scratch. I still don’t know what was causing it to not equip, but whatever, it’s solved now :slight_smile: