Using an unchecked function return value as the object for another function call is an anti-pattern. You should be checking all of those to make sure they are valid. Additionally, not every weapon will have a Print Name defined, necessarily. They should -- but not a guarantee.
if ( IsValid( LocalPlayer() ) ) then
if ( IsValid( LocalPlayer():GetActiveWeapon() ) ) then
draw.SimpleText( LocalPlayer():GetActiveWeapon():GetPrintName() or "NoPrintNameDefined", "Trebuchet24", ScrW() / 2 + 690, ScrH() / 2 + 305, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
end
endgetting the print name of the weapon when the player is either stripped or in jail
Well, when they don't have any active weapon, what do you expect GetActiveWeapon() to return?
