TTT Dead ringer not dropping corpse, disguised while invisible not working either
1 replies, posted
Hello! I have a small issue with this TTT weapon. The dead ringer will not drop a fake corpse when the traitor is shot (But he will still go invisible), and the name is not disguised while invisible (also known as Faking death) I also thought I added the code to disguise the invisible player's name correctly, but I somehow didn't. so I don't know what I did wrong or missed, can anyone help?
[code]
////////////////////
//Dead Ringer Swep//
///////Update///////
////by NECROSSIN////
////////////////////
///TTT Convert by///
///////PORTER///////
////////////////////
--Updated: 24 January 2010
--Converted : 01 May 2014
----------------------------
--////////////////////////--
local REDUCEDAMAGE = 1
--////////////////////////--
----------------------------
--was -- this SWEP uses models, textures and sounds from TF2, so be sure that you have it if you dont want to see an ERROR instead of swep model and etc...
--now -- included models, textures and sounds from TF2, so u don't need to install TeamFortress2...
resource.AddFile( "materials/vgui/ttt/weapon_dead_ringer.vmt" )
resource.AddFile( "materials/vgui/ttt/weapon_dead_ringer.vtf" )
resource.AddFile( "sound/ttt/recharged.wav" )
resource.AddFile( "sound/ttt/spy_uncloak_feigndeath.wav" )
resource.AddFile( "models/ttt/v_models/v_watch_pocket_spy.mdl" )
resource.AddFile( "models/ttt/v_models/v_watch_pocket_spy.sw.vtx" )
resource.AddFile( "models/ttt/c_models/c_pocket_watch.mdl" )
resource.AddFile( "models/ttt/c_models/c_pocket_watch.sw.vtx" )
resource.AddFile( "materials/vgui/ttt/misc_ammo_area_red.vmt" )
resource.AddFile( "materials/vgui/ttt/gradient_red.vtf" )
resource.AddFile( "materials/vgui/ttt/misc_ammo_area_mask.vtf" )
resource.AddFile( "materials/models/ttt/c_pocket_watch/c_pocket_watch.vtf" )
resource.AddFile( "materials/models/ttt/c_pocket_watch/c_pocket_watch.vmt" )
resource.AddFile( "materials/models/player/pyro/pyro_lightwarp.vtf" )
resource.AddFile( "materials/models/player/spy/spy_exponent.vtf" )
resource.AddFile( "materials/models/player/spy/spy_hands_blue.vmt" )
resource.AddFile( "materials/models/player/spy/spy_hands_blue.vtf" )
resource.AddFile( "materials/models/player/spy/spy_hands_normal.vtf" )
resource.AddFile( "materials/models/player/spy/spy_hands_red.vmt" )
resource.AddFile( "materials/models/player/spy/spy_hands_red.vtf" )
resource.AddFile( "materials/models/weapons/c_items/c_pocket_watch.vmt" )
resource.AddFile( "materials/models/weapons/c_items/c_pocket_watch.vtf" )
resource.AddFile( "materials/models/weapons/c_items/c_pocket_watch_lightwarp" )
resource.AddFile( "materials/models/weapons/c_items/c_pocket_watch_phongwarp.vtf" )
--------------------------------------------------------------------------
if (SERVER) then
AddCSLuaFile( "shared.lua" )
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.HoldType = "normal"
end
--------------------------------------------------------------------------
if ( CLIENT ) then
SWEP.PrintName = "Dead Ringer"
SWEP.Slot = 6
SWEP.EquipMenuData = {
type = "item_weapon",
desc = "Fake your death!"
};
SWEP.Icon = "vgui/ttt/weapon_dead_ringer"
SWEP.Author = "NECROSSIN (fixed by Niandra Lades / Converted by Porter)"
SWEP.DrawAmmo = false
SWEP.DrawCrosshair = false
SWEP.ViewModelFOV = 55
SWEP.ViewModelFlip = false
SWEP.CSMuzzleFlashes = false
SWEP.WepSelectIcon = surface.GetTextureID("models/ttt/c_pocket_watch/c_pocket_watch.vtf") -- texture from TF2
SWEP.IconLetter = "G"
surface.CreateFont( "DRfont", {
font = "coolvertica",
size = 13,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
} )
function drawdr()
--here goes the new HUD
if LocalPlayer():GetNWBool("Status") == 1 or LocalPlayer():GetNWBool("Status") == 3 or LocalPlayer():GetNWBool("Status") == 4 and LocalPlayer():Alive() then
local background = surface.GetTextureID("vgui/ttt/misc_ammo_area_red")
local w,h = surface.GetTextureSize(surface.GetTextureID("vgui/ttt/misc_ammo_area_red"))
surface.SetTexture(background)
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(13, ScrH() - h - 200, w*5, h*5 )
local energy = math.max(LocalPlayer():GetNWInt("drcharge"), 0)
draw.RoundedBox(2,44, ScrH() - h - 168, (energy / 8) * 77, 15, Color(255,222,255,255))
surface.SetDrawColor(255,255,255,255)
surface.DrawOutlinedRect(44, ScrH() - h - 168, 77, 15)
draw.DrawText("CLOAK", "DRfont",65, ScrH() - h - 150, Color(255,255,255,255))
end
end
hook.Add("HUDPaint", "drawdr", drawdr)
local function DRReady(um)
surface.PlaySound( "ttt/recharged.wav" )
end
usermessage.Hook("DRReady", DRReady)
end
-------------------------------------------------------------------
SWEP.Category = "Spy"
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.Purpose = "Fake your death!"
SWEP.Instructions = "Primary - turn on.\nSecondary - turn off or drop cloak."
SWEP.ViewModel = "models/ttt/v_models/v_watch_pocket_spy.mdl"
SWEP.WorldModel = ""
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Category = "Dead Ringer"
SWEP.Kind = WEAPON_EQUIP
SWEP.CanBuy = {ROLE_TRAITOR}
SWEP.WeaponID = AMMO_DEADRING
SWEP.LimitedStock = true
SWEP.Base = "weapon_tttbase"
SWEP.AllowDrop = false
SWEP.NoSights = true
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Ammo = ""
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Ammo = "none"
------------------------------------------
NPCs = { -- if you have custom NPC-enemies, you can add them here
"npc_zombie",
"npc_fastzombie",
"npc_zombie_torso",
"npc_poisonzombie",
"npc_antlion",
"npc_antlionguard",
"npc_hunter",
"npc_antlion_worker",
"npc_headcrab_black",
"npc_headcrab",
"npc_headcrab_fast",
"npc_combine_s",
"npc_zombine",
"npc_fastzombie_torso",
"npc_rollermine",
"npc_turret_floor",
"npc_cscanner",
"npc_clawscanner",
"npc_manhack",
"npc_tripmine",
"npc_barnacle",
"npc_strider",
"npc_metropolice",
}
-----------------------------------------------------------------------
-- disable dead rnger on spawn
if SERVER then
function dringerspawn( p )
if p:GetNWBool("Dead") == true then
p:SetNWBool( "Status", 0)
p:GetViewModel():SetMaterial("")
p:SetMaterial("")
p:SetColor(255,255,255,255)
end
p:SetNWBool( "Status", 0)
p:SetNWBool( "Dead", false)
p:SetNWBool( "CanAttack", true)
p:SetNWInt("drcharge", 8 )
end
hook.Add( "PlayerSpawn", "DRingerspawn", dringerspawn );
end
-----------------------------------
function SWEP:Initialize()
self:SetWeaponHoldType("normal")
end
-----------------------------------
function SWEP:Deploy()
if SERVER then
self.Owner:DrawWorldModel(false)
self.Owner:DrawWorldModel(false)
local ent = ents.Create("deadringer")
ent:SetOwner(self.Owner)
ent:SetParent(self.Owner)
ent:SetPos(self.Owner:GetPos())
ent:SetColor(self.Owner:GetColor())
ent:SetMaterial(self.Owner:GetMaterial())
ent:Spawn()
end
self.Weapon:SendWeaponAnim( ACT_VM_DRAW )
if !self.Owner:GetNWBool("Status") == 3 or !self.Owner:GetNWBool("Status") == 4 or !self.Owner:GetNWBool("Status") == 1 then
self.Owner:SetNWBool( "Status", 2)
end
return true
end
-----------------------------------
function SWEP:Think()
end
function SWEP:Holster()
local worldmodel = ents.FindInSphere(self.Owner:GetPos(),0.6)
for k, v in pairs(worldmodel) do
if v:GetClass() == "deadringer" and v:GetOwner() == self.Owner then
v:Remove()
end
end
return true
end
-----------------------------------
--------View Model material--------
-----------------------------------
if CLIENT then
function drvm()
if LocalPlayer():GetNWBool("Dead") == true and LocalPlayer():Alive() then
LocalPlayer():GetViewModel():SetMaterial( "models/props_c17/fisheyelens")
elseif LocalPlayer():GetNWBool("Dead") == false and LocalPlayer():Alive() then
LocalPlayer():GetViewModel():SetMaterial("models/weapons/v_crowbar.mdl"
Does no one know what's wrong? I've been tearing my hair out on what it could be...
[editline]5th August 2016[/editline]
Okay I fixed it! I feel really stupid...
I had to change
[code]
ply:SetNWBool("disguised", true) and ply:SetNWBool("disguised", false)
[/code]
to
[code]
self:SetNWBool("disguised", true) and self:SetNWBool("disguised", true)
[/code]
That fixed both problems.
Sorry, you need to Log In to post a reply to this thread.