• TTT adding avatar to corpse.
    9 replies, posted
Hello! I have a weapon that allows traitor's to fake their death. However when you check the fake corpse it shows a blue question mark instead of the steam avatar. Anyone know how to fix this so the fake body will show the avatar? Code Below: [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" ) resource.AddFile( "sound/ttt/walk_to_sprint.wav" ) resource.AddFile( "sound/ttt/sprint_to_walk.wav" ) if SERVER then util.AddNetworkString("FakePlayerDeathrun") end if SERVER then util.AddNetworkString("FakePlayerDeathwalk") end -------------------------------------------------------------------------- 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 = "Left click enables the dead ringer\nFakes death when damaged + 3 second Speed boost\nCloak lasts for 14 seconds max\nDead Ringer takes 28 seconds max to recharge\nCANNOT BE DROPPED!!" }; 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") util.PrecacheSound ( "sound/ttt/sprint_to_walk.wav" ) util.PrecacheSound ( "sound/ttt/walk_to_sprint.wav" ) 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() == "deadringe
Replace: [CODE] rag.uqid = self:UniqueID() [/CODE] With: [CODE] rag.sid = self:SteamID() [/CODE]
Still didn't work :\
Do you have replaced the cl_search.lua file with the cl_search.lua file from the dead ringer? If I'm not wrong then this file is outdated.
[QUOTE=markusmarkusz;50861613]Do you have replaced the cl_search.lua file with the cl_search.lua file from the dead ringer? If I'm not wrong then this file is outdated.[/QUOTE] I have the Dead Ringer addon with the cl_search.lua file that came with it. I tried removing it and then tried keeping it, both had no luck. [editline]10th August 2016[/editline] Here is the cl_search.lua that came with the Dead Ringer. [code] -- Body search popup local T = LANG.GetTranslation local PT = LANG.GetParamTranslation local is_dmg = util.BitSet -- "From his body you can tell XXX" local function DmgToText(d) if is_dmg(d, DMG_CRUSH) then return T("search_dmg_crush") elseif is_dmg(d, DMG_BULLET) then return T("search_dmg_bullet") elseif is_dmg(d, DMG_FALL) then return T("search_dmg_fall") elseif is_dmg(d, DMG_BLAST) then return T("search_dmg_boom") elseif is_dmg(d, DMG_CLUB) then return T("search_dmg_club") elseif is_dmg(d, DMG_DROWN) then return T("search_dmg_drown") elseif is_dmg(d, DMG_SLASH) then return T("search_dmg_stab") elseif is_dmg(d, DMG_BURN) or is_dmg(d, DMG_DIRECT) then return T("search_dmg_burn") elseif is_dmg(d, DMG_SONIC) then return T("search_dmg_tele") elseif is_dmg(d, DMG_VEHICLE) then return T("search_dmg_car") else return T("search_dmg_other") end end -- Info type to icon mapping -- Some icons have different appearances based on the data value. These have a -- separate table inside the TypeToMat table. -- Those that have a lot of possible data values are defined separately, either -- as a function or a table. local function DmgToMat(d) if is_dmg(d, DMG_BULLET) then return "bullet" elseif is_dmg(d, DMG_CRUSH) then return "rock" elseif is_dmg(d, DMG_BLAST) then return "splode" elseif is_dmg(d, DMG_FALL) then return "fall" elseif is_dmg(d, DMG_BURN) or is_dmg(d, DMG_DIRECT) then return "fire" else return "skull" end end local function WeaponToIcon(d) local wep = util.WeaponForClass(d) return wep and wep.Icon or "VGUI/ttt/icon_nades" end local TypeToMat = { nick="id", words="halp", eq_armor="armor", eq_radar="radar", eq_disg="disguise", role={[ROLE_TRAITOR]="traitor", [ROLE_DETECTIVE]="det", [ROLE_INNOCENT]="inno"}, c4="code", dmg=DmgToMat, wep=WeaponToIcon, head="head", dtime="time", stime="wtester", lastid="lastid", kills="list" }; -- Accessor for better fail handling local function IconForInfoType(t, data) local base = "VGUI/ttt/icon_" local mat = TypeToMat[t] if type(mat) == "table" then mat = mat[data] elseif type(mat) == "function" then mat = mat(data) end if not mat then mat = TypeToMat["nick"] end -- ugly special casing for weapons, because they are more likely to be -- customized and hence need more freedom in their icon filename if t != "wep" then return base .. mat else return mat end end function PreprocSearch(raw) local search = {} for t, d in pairs(raw) do search[t] = {img=nil, text="", p=10} if t == "nick" then search[t].text = PT("search_nick", {player = d}) search[t].p = 1 search[t].nick = d elseif t == "role" then if d == ROLE_TRAITOR then search[t].text = T("search_role_t") elseif d == ROLE_DETECTIVE then search[t].text = T("search_role_d") else search[t].text = T("search_role_i") end search[t].p = 2 elseif t == "words" then if d != "" then -- only append "--" if there's no ending interpunction local final = string.match(d, "[\\.\\!\\?]$") != nil search[t].text = PT("search_words", {lastwords = d .. (final and "" or "--.")}) end elseif t == "eq_armor" then if d then search[t].text = T("search_armor") search[t].p = 17 end elseif t == "eq_disg" then if d then search[t].text = T("search_disg") search[t].p = 18 end elseif t == "eq_radar" then if d then search[t].text = T("search_radar") search[t].p = 19 end elseif t == "c4" then if d > 0 then search[t].text= PT("search_c4", {num = d}) end elseif t == "dmg" then search[t].text = DmgToText(d) search[t].p = 12 elseif t == "wep" then local wep = util.WeaponForClass(d) local wname = wep and LANG.TryTranslation(wep.PrintName) if wname then search[t].text = PT("search_weapon", {weapon = wname}) end elseif t == "head" then if d then search[t].text = T("search_head") end search[t].p = 15 elseif t == "dtime" then if d != 0 then local ftime = util.SimpleTime(d, "%02i:%02i") search[t].text = PT("search_time", {time = ftime}) search[t].text_icon = ftime search[t].p = 8 end elseif t == "stime" then if d > 0 then local ftime = util.SimpleTime(d, "%02i:%02i") search[t].text = PT("search_dna", {time = ftime}) search[t].text_icon = ftime end elseif t == "kills" then local num = table.Count(d) if num == 1 then local vic = Entity(d[1]) local dc = d[1] == -1 -- disconnected if dc or (IsValid(vic) and vic:IsPlayer()) then search[t].text = PT("search_kills1", {player = (dc and "<Disconnected>" or vic:Nick())}) end elseif num > 1 then local txt = T("search_kills2") .. "\n" local nicks = {} for k, idx in pairs(d) do local vic = Entity(idx) local dc = idx == -1 if dc or (IsValid(vic) and vic:IsPlayer()) then table.insert(nicks, (dc and "<Disconnected>" or vic:Nick())) end end local last = #nicks txt = txt .. table.concat(nicks, "\n", 1, last) search[t].text = txt end search[t].p = 30 elseif t == "lastid" then if d and d.idx != -1 then local ent = Entity(d.idx) if IsValid(ent) and ent:IsPlayer() then search[t].text = PT("search_eyes", {player = ent:Nick()}) search[t].ply = ent end end else -- Not matching a type, so don't display search[t] = nil end -- anything matching a type but not given a text should be removed if search[t] and search[t].text == "" then search[t] = nil end -- if there's still something here, we'll be showing it, so find an icon if search[t] then search[t].img = IconForInfoType(t, d) end end return search end -- Returns a function meant to override OnActivePanelChanged, which modifies -- dactive and dtext based on the search information that is associated with the -- newly selected panel local function SearchInfoController(search, dactive, dtext) return function(s, pold, pnew) local t = pnew.info_type local data = search[t] if not data then ErrorNoHalt("Search: data not found", t, data,"\n") return end -- If wrapping is on, the Label's SizeToContentsY misbehaves for -- text that does not need wrapping. I long ago stopped wondering -- "why" when it comes to VGUI. Apply hack, move on. dtext:GetLabel():SetWrap(#data.text > 50) dtext:SetText(data.text) dactive:SetImage(data.img) end end
No one have any ideas or an updated cl_search file?
You can copy these three files from your client. (Navigate to your gmod folder, then to garrysmod/terrortown/gamemode/.) Or you use the one from GitHub. These three files have no changes for years. So they can easily be copied. But be aware. Updating the files can break some other things from the dead ringer. Edit: Updating cl_search.lua shouldn't break something from the dead ringer. But I'm not sure.
[QUOTE=markusmarkusz;50862927]You can copy these three files from your client. (Navigate to your gmod folder, then to garrysmod/terrortown/gamemode/.) Or you use the one from GitHub. These three files have no changes for years. So they can easily be copied. But be aware. Updating the files can break some other things from the dead ringer. Edit: Updating cl_search.lua shouldn't break something from the dead ringer. But I'm not sure.[/QUOTE] It broke it when I removed the files from the addon (So it can use the default TTT one). Searching a ringer's body will have the question mark still while normal bodies show up fine.
Totally forgotten. search.owner is made to nil because you're alive. See: [CODE] search.owner = Entity(net.ReadUInt(8)) if not (IsValid(search.owner) and search.owner:IsPlayer() and (not search.owner:Alive())) then search.owner = nil end [/CODE] [url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/terrortown/gamemode/cl_search.lua#L441-L444[/url] It seems like that you have to make a ugly work around. You can use for example the "TTTBodySearchEquipment"-Hook.
Sorry, you need to Log In to post a reply to this thread.