1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Player info

Discussion in 'DarkRP Modding Questions & Help' started by YurgBurg, Jan 11, 2015.

  1. YurgBurg

    YurgBurg Member

    Anyone got any idea why playerinfo won't shot over a players head like job license wanted or not wanted etc
     
  2. Matryan

    Matryan Well-Known Member

    Have you got a custom HUD?
     
  3. YurgBurg

    YurgBurg Member

    Yes I do.
     
  4. Matryan

    Matryan Well-Known Member

    That's probably it.
     
  5. YurgBurg

    YurgBurg Member

    Well could you point me in the direction where i can make the hud where it displays that?
     
  6. Matryan

    Matryan Well-Known Member

    Is the HUD a hudreplacement module or an addon?
     
  7. YurgBurg

    YurgBurg Member

    Module
     
  8. Matryan

    Matryan Well-Known Member

    Is it paid for / can you paste the code here / in pastebin? (if here, preferably in code tags)
     
  9. YurgBurg

    YurgBurg Member

    Code (Text):
    -[[---------------------------------------------------------
        Name: DrawPlayerInfo
    -----------------------------------------------------------]]
    local plyMeta = FindMetaTable("Player")
    plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self)

        local pos = self:EyePos()

        pos.z = pos.z + 10
        pos = pos:ToScreen()
        if not self:getDarkRPVar("wanted") then
            pos.y = pos.y - 50
        end

        if GAMEMODE.Config.showname then
            local nick, plyTeam = self:Nick(), self:Team()
            draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
            draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
        end

        if GAMEMODE.Config.showhealth then
            local health = DarkRP.getPhrase("health", self:Health())
            draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1)
            draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, Color(255, 255, 255, 200), 1)
        end

        if GAMEMODE.Config.showjob then
            local teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
            draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1)
            draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, Color(255, 255, 255, 200), 1)
        end

        if self:getDarkRPVar("HasGunlicense") then
            surface.SetMaterial(Page)
            surface.SetDrawColor(255,255,255,255)
            surface.DrawTexturedRect( Settings.PosX + Settings.Width + 10, Settings.PosY + Settings.Height - 32, 32, 32)
        end

    end


    --[[---------------------------------------------------------
        Name: DrawWantedInfo
    -----------------------------------------------------------]]
    plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self)

        if not self:Alive() then return end

        local pos = self:EyePos()
        if not pos:isInSight({LocalPlayer(), self}) then return end

        pos.z = pos.z + 10
        pos = pos:ToScreen()

        if GAMEMODE.Config.showname then
            draw.DrawNonParsedText(self:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
            draw.DrawNonParsedText(self:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(self:Team()), 1)
        end

        local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))

        draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, Color(255, 255, 255, 200), 1)
        draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, Color(255, 0, 0, 255), 1)

    end


    --[[---------------------------------------------------------
        Name: DrawEntityDisplay
    -----------------------------------------------------------]]
    local function DrawEntityDisplay()

        local shootPos = LocalPlayer():GetShootPos()
        local aimVec = LocalPlayer():GetAimVector()

        for k, ply in pairs(players or player.GetAll()) do
            if ply == LocalPlayer() or not ply:Alive() or ply:GetNoDraw() then continue end
            local hisPos = ply:GetShootPos()
            if ply:getDarkRPVar("wanted") then ply:drawWantedInfo() end

            if GAMEMODE.Config.globalshow then
                ply:drawPlayerInfo()
            -- Draw when you're (almost) looking at him
            elseif hisPos:DistToSqr(shootPos) < 160000 then
                local pos = hisPos - shootPos
                local unitPos = pos:GetNormalized()
                if unitPos:Dot(aimVec) > 0.95 then
                    local trace = util.QuickTrace(shootPos, pos, LocalPlayer())
                    if trace.Hit and trace.Entity ~= ply then return end
                    ply:drawPlayerInfo()
                end
            end
        end

        local tr = LocalPlayer():GetEyeTrace()

        if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():Distance(LocalPlayer():GetPos()) < 200 then
            tr.Entity:drawOwnableInfo()
        end

    end
     
  10. SwagLikeCaillou

    SwagLikeCaillou New Member


    and he never replied back!
     
  11. Jeep Stuff

    Jeep Stuff New Member

    it is for darkrpmodification/lua/darkrp_modules but that is from the cl_init.lua from the darkrp modules files
     
  12. Pab14567

    Pab14567 Well-Known Member

    what the hell are you asking
     
  13. Matryan

    Matryan Well-Known Member

    Whoops ¯\_(ツ)_/¯
     
    Pab14567 likes this.

Share This Page