To be able to limit the number of props on the map (to optimize server), I purpose you an LUA script than you can easily customize for your requirements.

DarkRP already has a way to buy props, but the following script will add a GUI that asks players to validate their choice with "Yes" or "No", which is visually more beautiful.

How to use

  1. You need to create a  paytospawn directory inside garrysmod/addons.
  2. Go to  garrysmod/addons/paytospawn and create  autorun folder.
  3. Inside autorun, create a file shared.lua which contains the following scripts, and reboot your GMod server.
lmmpropcost = 75 -- Price of object (A)

if (SERVER) then
  util.AddNetworkString("LMMPlayerSpawnPropCL")
  util.AddNetworkString("LMMPlayerSpawnPropCLBack")
  hook.Add( "PlayerSpawnProp", "LMMPlayerSpawnProp", function( ply, mdl )
    if ply:GetNWBool("LMMCanSpawnProp") then
      return true
    else
      net.Start("LMMPlayerSpawnPropCL")
        net.WriteString(mdl)
      net.Send(ply)
    end
  end )

  net.Receive("LMMPlayerSpawnPropCLBack",function(len, ply)
    local mdl = net.ReadString()
    ply:addMoney(-lmmpropcost)
    ply:SetNWBool("LMMCanSpawnProp",true)
    ply:ConCommand("gm_spawn "..mdl)
    timer.Simple(1,function()
      ply:SetNWBool("LMMCanSpawnProp",false)
    end)
  end)
end

if (CLIENT) then
  surface.CreateFont( "DRPTitleFont", {
      font = "Arial",
      size = 25,
      weight = 5000,
      blursize = 0,
      scanlines = 0,
      antialias = true,
  })

  surface.CreateFont( "DRPLabelFont", {
      font = "Arial",
      size = 20,
      weight = 5000,
      blursize = 0,
      scanlines = 0,
      antialias = true,
  })

  surface.CreateFont( "DRPBtnLabelFont", {
      font = "Arial",
      size = 15,
      weight = 5000,
      blursize = 0,
      scanlines = 0,
      antialias = true,
  })

  net.Receive("LMMPlayerSpawnPropCL",function()
    local mdl = net.ReadString()
    local DFrame = vgui.Create( "DFrame" )
    DFrame:SetSize( 450, 100 )
    DFrame:Center()
    DFrame:SetTitle( "" )
    DFrame:SetDraggable( false )
    DFrame:ShowCloseButton(false)
    DFrame:MakePopup()
    function DFrame:Paint(w, h)
      draw.RoundedBox(2, 0, 0, self:GetWide(), self:GetTall(), Color(35, 35, 35, 250))
      draw.RoundedBox(2, 0, 0, self:GetWide(), 30, Color(0, 102, 255, 250))
      draw.SimpleText( "Buy props!", "DRPTitleFont", self:GetWide() / 2, 15, Color(255,255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
    end

    local Label1 = vgui.Create("DLabel", DFrame)
    Label1:SetPos(30,40)
    Label1:SetSize(400,20)
    Label1:SetText("Are you sure to buy "..DarkRP.formatMoney(lmmpropcost).."?")
    Label1:SetTextColor(Color(255,255,255,255))
    Label1:SetFont("DRPLabelFont")

    local YesBTN = vgui.Create("DButton", DFrame)
    YesBTN:SetPos(30, 70)
    YesBTN:SetSize(150, 20)
    YesBTN:SetText("Yes")
    YesBTN:SetFont("DRPBtnLabelFont")
    YesBTN.OnCursorEntered = function(self)
      self.hover = true
    end
    YesBTN.OnCursorExited = function(self)
      self.hover = false
    end
    YesBTN.Paint = function( self, w, h )
      if self.IsClose then
        draw.RoundedBox(0, 0, 0, w, h, (self.hover and Color(88,0,0,250) or Color(255,255,255,255))) -- Paints on hover
      else
        draw.RoundedBox(0, 0, 0, w, h, (self.hover and Color(0,160,255,250) or Color(255,255,255,255))) -- Paints on hover
      end
      self:SetTextColor(self.hover and Color(255,255,255,255) or Color(0,0,0,250))
    end
    YesBTN.DoClick = function()
      net.Start("LMMPlayerSpawnPropCLBack")
        net.WriteString(mdl)
      net.SendToServer()
      DFrame:Close()
    end

    local NoBTN = vgui.Create("DButton", DFrame)
    NoBTN:SetPos(220, 70)
    NoBTN:SetSize(150, 20)
    NoBTN:SetText("No")
    NoBTN.IsClose = true
    NoBTN:SetFont("DRPBtnLabelFont")
    NoBTN.OnCursorEntered = function(self)
      self.hover = true
    end
    NoBTN.OnCursorExited = function(self)
      self.hover = false
    end
    NoBTN.Paint = function( self, w, h )
      if self.IsClose then
        draw.RoundedBox(0, 0, 0, w, h, (self.hover and Color(88,0,0,250) or Color(255,255,255,255))) -- Paints on hover
      else
        draw.RoundedBox(0, 0, 0, w, h, (self.hover and Color(0,160,255,250) or Color(255,255,255,255))) -- Paints on hover
      end
      self:SetTextColor(self.hover and Color(255,255,255,255) or Color(0,0,0,250))
    end
    NoBTN.DoClick = function()
      DFrame:Close()
    end
  end)
end