Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[---------------------------------------------------------------------------
- Rank Icons Config
- ---------------------------------------------------------------------------]]
- local RankIcons = {}
- local function mat(texture) return Material(texture, 'smooth') end
- local function addRankIcon( rank, icon )
- RankIcons[rank] = {rank = rank, icon = icon}
- end
- // Do not touch anything above!
- -------------------Easy config for you :)
- addRankIcon( "Citizen", mat( "icons/div/31.png" ) )
- addRankIcon( "Hobo", mat("icons/div/31.png") )
- addRankIcon( "Pig Eater", mat("icons/div/31.png") ) ---The rank icon is set based off the job name you set in the DarkRP jobs,
- --------you post the image path after mat remeber to use ""
- -----------------------------DONT TOUCH ANYTHING BELOW THIS LINE
- local function DrawRankIcons( self )
- local pos = self:EyePos()
- local nick = self:Nick()
- pos.z = pos.z + 15 -- Above the head a bit
- pos = pos:ToScreen()
- if RankIcons[ team.GetName( self:Team() ) ] then
- surface.SetMaterial( RankIcons[ team.GetName( self:Team() ) ].icon )
- surface.SetDrawColor(255,255,255,255)
- surface.DrawTexturedRect(pos.x - 16, pos.y - 74, 40, 40)
- end
- end
- local function NutScripts_RankIconsView()
- local LP = LocalPlayer()
- local shootPos = LP:GetShootPos()
- local aimVec = LP:GetAimVector()
- local tr = LP:GetEyeTrace()
- local allPlayers = player.GetAll()
- for i = 1, #allPlayers do
- local ply = allPlayers[i]
- if ply == LP or not ply:Alive() or ply:GetNoDraw() then continue end
- local hisPos = ply:GetShootPos()
- if hisPos:DistToSqr(shootPos) < 160000 then --Distance from player that it displays
- local pos = hisPos - shootPos
- local unitPos = pos:GetNormalized()
- if unitPos:Dot(aimVec) > 0.45 then
- local trace = util.QuickTrace(shootPos, pos, LP)
- DrawRankIcons(ply)
- end
- end
- end
- end
- local function rIHUD()
- NutScripts_RankIconsView()
- end
- hook.Add("HUDPaint","drawRankIconsHUD",rIHUD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement