Spawning an entity with a chat command

im looking for a script that will allow a player to spawn a entity or gun with a command they type in chat or console. It also has to be only for a certain user group

[lua]function giveent( ply )
if ply:IsUserGroup( “Putusergrouphere” ) then
ply:Give( “entname” )
ply:PrintMessage( HUD_PRINTTALK, “You have received an ent” )
else
ply:PrintMessage( HUD_PRINTTALK, “You are not in the required usergroup” )
end
end
concommand.Add( “whatever”, giveent )[/lua]

Untested.