Naming people following jobs

Hello everybody,

                                                I'm creating a Millitary RP server, and I wondered how I could give a certain player a tag following his rank.

For example, let’s say his name is John Mc Queen. When he is a simple citizen, he will be called John Mc Queen, but if he choses to be Commander, I would like his name to become " Commander John Mc Queen" during him having the job, and when he dies, it comes back to John Mc Queen.

                                              How could it be possible ? Which functions should I call ? I'm a lua beginner so I have a lot to learn, but I know I would have to check the team using 

 if ply:Team() == TEAM_XXXX 

                                                                                                                            and use the function 

 GM:PlayerLoadout( ply ) 

                           Any help would be highly appreciated  :)  ( and sorry for the potential mistakes, english is not my first Language )

You can call this hook and run the whole if team statement then do whatever you need to!