3d2d Rank

Is it possible to modify this script to make it display the players Rank? IE Admin, Respected, Super admin, ect. I’m using Assmod if that helps at all.

function DrawName( ply )

if !ply:Alive() then return end

local offset = Vector( 0, 0, 85 )
local ang = LocalPlayer():EyeAngles()
local pos = ply:GetPos() + offset + ang:Up()

ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )

surface.CreateFont ( "coolvetica", 40, 400, true, false, "CV20", true )

cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
	draw.DrawText( ply:GetName(), "CV20", 2, 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
cam.End3D2D()

end
hook.Add( “PostPlayerDraw”, “DrawName”, DrawName )

Replace ply:GetName() with ply:GetLevel()

(I think)

Actually that would only display his “level” number. Try replacing them with their specific names. 1 is Owner IIRC

Replacing what?

[lua]
Ranks = {“Owner”, “Super Admin”, “Admin”–[[, etc…]]}
Ranks[ply:GetLevel()]
[/lua]

I have no idea if the ranks are right, but you get the idea.

I don’t quite get what you’re saying portal

How would I integrate that into my script?

[lua]draw.DrawText( Ranks[ply:GetLevel()] , “CV20”, 2, 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )[/lua]

And the # Ranks = {“Owner”, “Super Admin”, “Admin”–[[, etc…]]} portion?

Does that just directly above or below the start/end 3d2d block?

it doesn’t matter, as long as it’s defined somewhere before it’s referenced.

Hm, I have this at the moment;

[Lua]function DrawName( ply )
Ranks = {“Owner”, “Super Admin”, “Admin”, “Respected”, “Guest”, “Temp Admin”}

if !ply:Alive() then return end

local offset = Vector( 0, 0, 79 )
local ang = LocalPlayer():EyeAngles()
local pos = ply:GetPos() + offset + ang:Up()

ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )

surface.CreateFont ( "HUDNumber", 40, 400, true, false, "HUDNumber", true )
Ranks = {"Owner", "Super_Admin", "Admin", "Temp_Admin", "Respected", "Guest"}
cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
	draw.DrawText( Ranks[ply:GetLevel()] , "HUDNumber", 2, 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
cam.End3D2D()

end
hook.Add( “PostPlayerDraw”, “DrawName”, DrawName )[/lua]

I also tried placing the ranks line in the init.lua and still nothing.

Hook ‘DrawName’ Failed: [@lua\includes\modules\draw.lua:149] bad argument #1 to ‘len’ (string expected, got nil)
Error in console that comes up

[lua]
function DrawName( ply )
if !ply:Alive() then return end

local offset = Vector( 0, 0, 79 )
local ang = LocalPlayer():EyeAngles()
local pos = ply:GetPos() + offset + ang:Up()

ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Right(), 90 )

cam.Start3D2D( pos, Angle( 0, ang.y, 90 ), 0.25 )
	-- LevelToString is an assmod function.
	draw.DrawText( LevelToString(ply:GetLevel()) ,"HUDNumber", 2, 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
cam.End3D2D()

end
hook.Add( “PostPlayerDraw”, “DrawName”, DrawName )
[/lua]

http://img245.imageshack.us/img245/4407/3d2d.png