Help with lua, how do i make a command?

how do I make a command• similar to a advert command? I need to make a admin announcement command so if the player is an admin and types /aadvert the it will do [ADMINADVERT] before the message. Could someone help please?

SO far I thought of this its probably very wrong but I started lua about a week ago.

function AdminAd (ply , text , public)
if (string.sub(text , 1 , 7) == ‘/aadvert’) then
ply:ChatPrint(’[AdminAdvert]’ string)
end
end

hook.Add( “PlayerSay”, “AdminAd”, chatCommand );


(User was banned for this post ("wrong section" - postal))