ULX

Author Topic: Spawning problem  (Read 5570 times)

0 Members and 1 Guest are viewing this topic.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Spawning problem
« on: December 27, 2013, 03:20:07 AM »
Hello

I know that my problem is not related to ULX or something in around this topic but I need help.

I started my own TTT server. Everything is fine, but not spawns. After the round has ended, people spawn where they were on spectator. I have no idea what I should show you to help you helping me. Sorry for my grammar and other stuff. Thanks

Offline jackg904

  • Newbie
  • *
  • Posts: 10
  • Karma: 1
Re: Spawning problem
« Reply #1 on: December 27, 2013, 10:27:59 AM »
I had this issue, found it to be related to a Coderhire Addon named "TrueTTT" If you remove that, I have a feeling the issue will be sorted.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #2 on: December 27, 2013, 11:44:32 AM »
But I don't have that addon. I got cannibalism, defibrillator, awp, tripwire, turret and the crossbow.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Spawning problem
« Reply #3 on: December 27, 2013, 11:47:46 AM »
Start removing addons one by one and restarting the server until it starts working again. That's usually what I do when I have problems like that.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #4 on: December 27, 2013, 12:52:32 PM »
I tried and it did not work :/

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Spawning problem
« Reply #5 on: December 27, 2013, 03:20:18 PM »
Define "it did not work"
Experiencing God's grace one day at a time.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #6 on: December 28, 2013, 02:01:55 AM »
Nothing changed. Everyone still spawns where they were on spectator.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Spawning problem
« Reply #7 on: December 28, 2013, 02:46:33 AM »
Can I see the lua of the defibrillator and the cannibalism mod?

Since defib has to do with spawning people where they died,
I would expect that to be the issue.

And as for cannibalism, I'm not sure.
Have you tried removing the defib yet?

If that doesn't work, perhaps remove cannibalism.
Out of the Garry's Mod business.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #8 on: December 28, 2013, 03:32:22 AM »
Defib:
Code: [Select]
if SERVER then
  resource.AddFile("materials/vgui/ttt/icon_rg_defibrillator.png")
end

local STATE_NONE, STATE_PROGRESS, STATE_ERROR = 0, 1, 2
local color_red = Color(255, 0, 0)

SWEP.Base = "weapon_tttbase"

SWEP.HoldType = "slam"
SWEP.ViewModel = Model("models/weapons/v_c4.mdl")
SWEP.WorldModel = Model("models/weapons/w_c4.mdl")

--- TTT Vars
SWEP.Kind = WEAPON_EQUIP2
SWEP.AutoSpawnable = false
SWEP.CanBuy = {ROLE_TRAITOR}
SWEP.LimitedStock = true

if CLIENT then
  SWEP.PrintName = "Defibrillator"
  SWEP.Slot = 7

  SWEP.Icon = "vgui/ttt/icon_rg_defibrillator.png"

  SWEP.EquipMenuData = {
    type = "item_weapon",
    name = "Defribrillator",
    desc = "Resurrect dead mates with this one!"
  }

  surface.CreateFont("DefibText", {
    font = "Tahoma",
    size = 13,
    weight = 700,
    shadow = true
  })

  function SWEP:DrawHUD()
    local state = self:GetDefibState()
    local scrW, scrH = ScrW(), ScrH()
    local progress = 1
    local outlineCol, progressCol, progressText = color_white, color_white, ""

    if state == STATE_PROGRESS then
      local startTime, endTime = self:GetDefibStartTime(), self:GetDefibStartTime() + 5

      progress = math.TimeFraction(startTime, endTime, CurTime())

      if progress <= 0 then
        return
      end

      outlineCol = Color(0, 100, 0)
      progressCol = Color(0, 255, 0, (math.abs(math.sin(RealTime() * 3)) * 100) + 20)
      progressText = self:GetStateText() or "DEFIBRILLATING"
    elseif state == STATE_ERROR then
      outlineCol = color_red
      progressCol = Color(255, 0, 0, math.abs(math.sin(RealTime() * 15)) * 255)
      progressText = self:GetStateText() or ""
    else
      return
    end

    progress = math.Clamp(progress, 0, 1)

    surface.SetDrawColor(outlineCol)
    surface.DrawOutlinedRect(scrW / 2 - (200 / 2) - 1, scrH / 2 + 10 - 1, 202, 16)

    surface.SetDrawColor(progressCol)
    surface.DrawRect(scrW / 2  - (200 / 2), scrH / 2 + 10, 200 * progress, 14)

    surface.SetFont("DefibText")
    local textW, textH = surface.GetTextSize(progressText)

    surface.SetTextPos(scrW / 2 - 100 + 2, scrH / 2 - 20 + textH)
    surface.SetTextColor(color_white)
    surface.DrawText(progressText)
  end
end

function SWEP:SetupDataTables()
  self:NetworkVar("Int", 0, "DefibState")
  self:NetworkVar("Float", 1, "DefibStartTime")

  self:NetworkVar("String", 0, "StateText")
end

function SWEP:Initialize()
  self:SetDefibState(STATE_NONE)
  self:SetDefibStartTime(0)
end

function SWEP:Deploy()
  self:SetDefibState(STATE_NONE)
  self:SetDefibStartTime(0)

  return true
end

function SWEP:Holster()
  self:SetDefibState(STATE_NONE)
  self:SetDefibStartTime(0)

  return true
end


function SWEP:PrimaryAttack()
  if CLIENT then return end

  local tr = util.TraceLine({
    start = self.Owner:EyePos(),
    endpos = self.Owner:EyePos() + self.Owner:GetAimVector() * 80,
    filter = self.Owner
  })

  if IsValid(tr.Entity) and tr.Entity:GetClass() == "prop_ragdoll" then
    if not tr.Entity.uqid then
      self:FireError("FAILURE - SUBJECT BRAINDEAD")
      return
    end

    local ply = player.GetByUniqueID(tr.Entity.uqid)

    if IsValid(ply) then
      self:BeginDefib(ply, tr.Entity)
    else
      self:FireError("FAILURE - SUBJECT BRAINDEAD")
      return
    end
  else
    self:FireError("FAILURE - INVALID TARGET")
  end
end

function SWEP:BeginDefib(ply, ragdoll)
  local spawnPos = self:FindPosition(self.Owner)

  if not spawnPos then
    self:FireError("FAILURE - INSUFFICIENT ROOM")
    return
  end

  self:SetStateText("DEFIBRILLATING - "..string.upper(ply:Name()))
  self:SetDefibState(STATE_PROGRESS)
  self:SetDefibStartTime(CurTime())

  self.TargetPly = ply
  self.TargetRagdoll = ragdoll

  self:SetNextPrimaryFire(CurTime() + 6)
end

function SWEP:FireError(err)
  if err then
    self:SetStateText(err)
  else
    self:SetStateText("")
  end

  self:SetDefibState(STATE_ERROR)

  timer.Simple(1, function()
    if IsValid(self) then
      self:SetDefibState(STATE_NONE)
      self:SetStateText("")
    end
  end)

  self:SetNextPrimaryFire(CurTime() + 1.2)
end

function SWEP:FireSuccess()
  self:SetDefibState(STATE_NONE)
  self:SetNextPrimaryFire(CurTime() + 1)
 
  hook.Call("UsedDefib", GAMEMODE, self.Owner)

  self:Remove()
end

function SWEP:Think()
  if CLIENT then return end

  if self:GetDefibState() == STATE_PROGRESS then
    if not IsValid(self.Owner) then
      self:FireError()
      return
    end

    if not (IsValid(self.TargetPly) and IsValid(self.TargetRagdoll)) then
      self:FireError("ERROR - SUBJECT BRAINDEAD")
      return
    end

    local tr = util.TraceLine({
      start = self.Owner:EyePos(),
      endpos = self.Owner:EyePos() + self.Owner:GetAimVector() * 80,
      filter = self.Owner
    })

    if tr.Entity ~= self.TargetRagdoll then
      self:FireError("ERROR - TARGET LOST")
      return
    end

    if CurTime() >= self:GetDefibStartTime() + 5 then
      if self:HandleRespawn() then
        self:FireSuccess()
      else
        self:FireError("ERROR - INSUFFICIENT ROOM")
        return
      end
    end


    self:NextThink(CurTime())
    return true
  end
end

function SWEP:HandleRespawn()
  local ply, ragdoll = self.TargetPly, self.TargetRagdoll
  local spawnPos = self:FindPosition(self.Owner)

  if not spawnPos then
    return false
  end

  local credits = CORPSE.GetCredits(ragdoll, 0)

  ply:SpawnForRound(true)
  ply:SetCredits(credits)
  ply:SetPos(spawnPos)
  ply:SetEyeAngles(Angle(0, ragdoll:GetAngles().y, 0))

  ragdoll:Remove()

  return true
end


local Positions = {}
for i=0,360,22.5 do table.insert( Positions, Vector(math.cos(i),math.sin(i),0) ) end -- Populate Around Player
table.insert(Positions, Vector(0, 0, 1)) -- Populate Above Player

function SWEP:FindPosition(ply)
  local size = Vector(32, 32, 72)
 
  local StartPos = ply:GetPos() + Vector(0, 0, size.z/2)
 
  local len = #Positions
 
  for i = 1, len do
    local v = Positions[i]
    local Pos = StartPos + v * size * 1.5
   
    local tr = {}
    tr.start = Pos
    tr.endpos = Pos
    tr.mins = size / 2 * -1
    tr.maxs = size / 2
    local trace = util.TraceHull(tr)
   
    if(not trace.Hit) then
      return Pos - Vector(0, 0, size.z/2)
    end
  end

  return false
end

EDIT -JamminR - Use code tags to keep the post tidy.
« Last Edit: December 28, 2013, 08:16:30 AM by JamminR »

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #9 on: December 28, 2013, 03:34:27 AM »
Cannibalism :
Code: [Select]
if SERVER then
AddCSLuaFile( "shared.lua" )
resource.AddFile("materials/vgui/ttt/ttt_cannibalism.vmt")
resource.AddFile("materials/vgui/ttt/ttt_cannibalism.vtf")
end

if CLIENT then
SWEP.PrintName = "Cannibalism"
SWEP.Slot      = 7 -- add 1 to get the slot number key

SWEP.ViewModelFOV  = 72
SWEP.ViewModelFlip = true
end

-- Always derive from weapon_tttbase.
SWEP.Base = "weapon_tttbase"

--- Standard GMod values

SWEP.HoldType = "melee"

SWEP.Primary.Delay       = 10
SWEP.Primary.Recoil      = 0
SWEP.Primary.Automatic   = false
SWEP.Primary.Damage      = 0
SWEP.Primary.Cone        = 0.025
SWEP.Primary.Ammo        = ""
SWEP.Primary.ClipSize    = 1
SWEP.Primary.ClipMax     = 1
SWEP.Primary.DefaultClip = 1

SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 )
SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 )

SWEP.ViewModel  = "models/weapons/v_knife_t.mdl"
SWEP.WorldModel = "models/weapons/w_knife_t.mdl"

function SWEP:ShouldDropOnDie()
self:Remove()
end

function SWEP:OnDrop()
self:Remove()
end

function SWEP:PrimaryAttack()
if not self:CanPrimaryAttack() then return end

self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )

local tracedata = {}
tracedata.start = self.Owner:GetShootPos()
tracedata.endpos = self.Owner:GetShootPos() + (self.Owner:GetAimVector() * 100)
tracedata.filter = self.Owner
tracedata.mins = Vector(1,1,1) * -10
tracedata.maxs = Vector(1,1,1) * 10
tracedata.mask = MASK_SHOT_HULL
local tr = util.TraceHull( tracedata )

local ply = self.Owner

if IsValid(tr.Entity) then
if tr.Entity.player_ragdoll then

timer.Simple(0.1, function()
    ply:Freeze(true)
    ply:SetColor(Color(255,0,0,255))
end)
          self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)

          timer.Create("GivePlyHealth_"..self.Owner:UniqueID(),0.5,6,function() self.Owner:SetHealth(self.Owner:Health()+5) end)

timer.Simple(3.1, function()
ply:Freeze(false)
ply:SetColor(Color(255,255,255,255))
          tr.Entity:Remove()
          self:Remove()
end )


end
end
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)

end

--- TTT config values

-- Kind specifies the category this weapon is in. Players can only carry one of
-- each. Can be: WEAPON_... MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE.
-- Matching SWEP.Slot values: 0      1       2     3      4      6       7        8
SWEP.Kind = WEAPON_EQUIP2

-- If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can
-- be spawned as a random weapon. Of course this AK is special equipment so it won't,
-- but for the sake of example this is explicitly set to false anyway.
SWEP.AutoSpawnable = false

-- The AmmoEnt is the ammo entity that can be picked up when carrying this gun.
SWEP.AmmoEnt = ""

-- CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If
-- a role is in this table, those players can buy this.
SWEP.CanBuy = {ROLE_TRAITOR}

-- InLoadoutFor is a table of ROLE_* entries that specifies which roles should
-- receive this weapon as soon as the round starts. In this case, none.
SWEP.InLoadoutFor = nil

-- If LimitedStock is true, you can only buy one per round.
SWEP.LimitedStock = true

-- If AllowDrop is false, players can't manually drop the gun with Q
SWEP.AllowDrop = true

-- If IsSilent is true, victims will not scream upon death.
SWEP.IsSilent = false

-- If NoSights is true, the weapon won't have ironsights
SWEP.NoSights = true

-- Equipment menu information is only needed on the client
if CLIENT then
-- Path to the icon material
SWEP.Icon = "vgui/ttt/ttt_cannibalism"

-- Text shown in the equip menu
SWEP.EquipMenuData = {
type = "Weapon",
desc = "CANNIBALISM! GET RID OF EVIDENCE AND GAIN HEALTH!"
};
end

EDIT -JamminR - Use code tags to keep the post tidy.
« Last Edit: December 28, 2013, 08:17:39 AM by JamminR »

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Spawning problem
« Reply #10 on: December 28, 2013, 04:38:47 PM »
I've used those two sweps on my own local server with a bot, and it seems
they are not the problem.

Are there any other mods you have? Besides sweps.
Out of the Garry's Mod business.

Offline Kawo

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: Spawning problem
« Reply #11 on: December 29, 2013, 02:48:17 AM »
I have RDM Manager, joining/leaving messages, mapvote and ULX Admin Mod

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Spawning problem
« Reply #12 on: December 29, 2013, 11:31:08 AM »
Try removing each of those one by one and test each time.

Don't remove ULX though.
Out of the Garry's Mod business.