How do I make a SWEP that does a server command?

For example; I am making a Swep that when you left click it will ban the player it is looking at. How do I do this, is it possible?
the command would be something like,
“ulx ban playername

Thanks

RunConsoleCommand(“ulx”, “ban”, player:Name())

well, one more thing.

Where do I put RunConsoleCommand(“ulx”, “ban”, player:Name()) in the shared.lua?

here’s my LUA file.


-- All code by Kez


if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	SWEP.HoldType			= "pistol"
	
end

if ( CLIENT ) then

	SWEP.Author				= "[Buttery Toast]"
	SWEP.Contact			= "JohnnyAnimator@aol.com"
	SWEP.Purpose			= "Quickly Ban Minges."
	SWEP.Instructions		= "Left Click to ban person."
	SWEP.PrintName			= "BAN TOOL"
	SWEP.Slot				= 2
	SWEP.SlotPos			= 0
	SWEP.IconLetter			= "B"
	
	SWEP.ViewModelFlip		= true
	
	killicon.AddFont("cse_p228","CSKillIcons",SWEP.IconLetter,Color(255,80,0,255))
	
end


SWEP.Base				= "weapon_cs_base"

SWEP.Spawnable			= false
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_357.mdl"
SWEP.WorldModel			= "models/weapons/w_357.mdl"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= true
SWEP.AutoSwitchFrom		= true

SWEP.Primary.Sound			= Sound( "357_fire2.wav" )
SWEP.Primary.Recoil			= 5
SWEP.Primary.Damage			= 99999
SWEP.Primary.NumShots		= 10
SWEP.Primary.Cone			= 0.2
SWEP.Primary.ClipSize		= 999999999999
SWEP.Primary.Delay			= 0.01
SWEP.Primary.DefaultClip	= 9999999999
SWEP.Primary.Automatic		= false
SWEP.Primary.Ammo			= "pistol"

SWEP.Secondary.Sound			= Sound( "alarm1.wav" )
SWEP.Secondary.Recoil			= 0
SWEP.Secondary.Damage			= 10
SWEP.Secondary.NumShots		= 1
SWEP.Secondary.Cone			= 0.2
SWEP.Secondary.ClipSize		= 999999999999
SWEP.Secondary.Delay			= 0.01
SWEP.Secondary.DefaultClip	= 9999999999
SWEP.Secondary.Automatic		= false
SWEP.Secondary.Ammo			= "pistol"

SWEP.IronSightsPos = Vector(-5.15,-3,2.37)
SWEP.IronSightsAng = Vector(-.4,0,0)

[editline]02:55PM[/editline]

someone, help, where do I put the command into my lua file?!!?

[editline]03:08PM[/editline]

Help

[editline]03:08PM[/editline]

Please

function SWEP:PrimaryFire()
if CLIENT then RunConsoleCommand(“ulx”, “ban”, LocalPlayer():GetEyeTrace().Entity:Name()) end
end