Doors and Chat

  1. Doors

 First, I am looking for a script that will get all the doors in a map, then somehow arrange a table 
of all these doors and allow players to purchase / sell them and only the owner can lock / unlock them.

Second, when the first part is achieved, I will need the name of the person to show up in the middle of the door.

  1. Chat

 I need a script that will allow commands to be entered in the chat window in game.
For example, someone types /global and the message is sent to all players with a [Global] tag placed **before** 
the players name and with a different color.

I will also need a /local command that will send a message to players in the vicinity of the player who issued the command.

I have been playing around for a few hours trying to get this to work, and yes I have tried manipulating:

[lua]function ISaid( ply, text, team )
if (string.sub(text, 1, 4) == “/all”) then–if the first 4 letters are /all continue
return “[Global]”…string.sub( text, 5 );–add [Global] infront of the players text then display
hook.Add( “PlayerSay”, “ISaid”, ISaid );[/lua]

But would much rather the [Global] to be placed before the player name, which I guess will have to override GM:OnPlayerChat or something.

As for the doors, I have played with many different loops of
[lua]for k, v in pairs(ents.FindByClass(“func_door”)) do[/lua]
but still haven’t got it to work.