• Ban hammer
    2 replies, posted
A swep (I don't care about models, I can make those later) that kicks a player hit. if you can make the secondary fire a one hour ban, which is the normal ban time. Just the simple ULX command of either (I prefer) the console command "ulx ban/kick "asdfujasd" 60 Banhammer'd" or just no reason at all. If you make it a chat command, it will look like I typed it and everyone will see the command, but i'm fine if that's how you do it. If this is a repeat, please link me and lock the thread. Thank you.
I've actually been thinking of a swep like this a while ago. I'll see if I can make it, probably cant, but hell... I'll give it a shot. [editline]06:24AM[/editline] [code]if (SERVER) then AddCSLuaFile("shared.lua"); resource.AddFile("models/weapons/v_stunstick.dx80.vtx"); resource.AddFile("models/weapons/v_stunstick.dx90.vtx"); resource.AddFile("models/weapons/v_stunstick.mdl"); resource.AddFile("models/weapons/v_stunstick.phy"); resource.AddFile("models/weapons/v_stunstick.sw.vtx"); resource.AddFile("models/weapons/v_stunstick.vvd"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_diffuse.vmt"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_diffuse.vtf"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_normal.vtf"); end; if (CLIENT) then SWEP.PrintName = "BanHammer"; SWEP.Slot = 1; SWEP.SlotPos = 2; SWEP.DrawAmmo = false; SWEP.DrawCrosshair = true; end SWEP.Author = "Busymonkey"; SWEP.Instructions = "Primary Fire: Kick\nSecondary Fire: 1 Hour Ban."; SWEP.Contact = ""; SWEP.Purpose = "Kicking and Banning people."; SWEP.ViewModel = "models/weapons/v_stunstick.mdl"; SWEP.WorldModel = "models/weapons/w_stunbaton.mdl"; SWEP.AnimPrefix = "admire"; SWEP.Spawnable = false; SWEP.AdminSpawnable = true; SWEP.Primary.ClipSize = -1; SWEP.Primary.DefaultClip = 0; SWEP.Primary.Automatic = false; SWEP.Primary.Ammo = ""; SWEP.Secondary.ClipSize = -1; SWEP.Secondary.DefaultClip = 0; SWEP.Secondary.Automatic = false; SWEP.Secondary.Ammo = ""; function SWEP:Initialize() if (SERVER) then self:SetWeaponHoldType("normal"); end; end; function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + 1); if (CLIENT) then return; end; local trace = self.Owner:GetEyeTrace(); if (self.Owner:GetPos():Distance( trace.HitPos ) <= 128) then if ( ValidEntity(trace.Entity) and ( trace.Entity:IsPlayer() then ply:Kick("Kicked!") ) end; end; end; end; function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire(CurTime() + 1); if (CLIENT) then return; end; local trace = self.Owner:GetEyeTrace(); if (self.Owner:GetPos():Distance( trace.HitPos ) <= 128) then if ( ValidEntity(trace.Entity) and ( trace.Entity:IsPlayer() then ply:BanId(60, "Banned for 1 hour!") end; end; end; end;[/code] Probably wont work. Still a rookie at Lua, unfortunately.
[QUOTE=Busymonkey;23072174]I've actually been thinking of a swep like this a while ago. I'll see if I can make it, probably cant, but hell... I'll give it a shot. [editline]06:24AM[/editline] [lua]if (SERVER) then AddCSLuaFile("shared.lua"); resource.AddFile("models/weapons/v_stunstick.dx80.vtx"); resource.AddFile("models/weapons/v_stunstick.dx90.vtx"); resource.AddFile("models/weapons/v_stunstick.mdl"); resource.AddFile("models/weapons/v_stunstick.phy"); resource.AddFile("models/weapons/v_stunstick.sw.vtx"); resource.AddFile("models/weapons/v_stunstick.vvd"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_diffuse.vmt"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_diffuse.vtf"); resource.AddFile("materials/models/weapons/v_stunstick/v_stunstick_normal.vtf"); end; if (CLIENT) then SWEP.PrintName = "BanHammer"; SWEP.Slot = 1; SWEP.SlotPos = 2; SWEP.DrawAmmo = false; SWEP.DrawCrosshair = true; end SWEP.Author = "Busymonkey"; SWEP.Instructions = "Primary Fire: Kick\nSecondary Fire: 1 Hour Ban."; SWEP.Contact = ""; SWEP.Purpose = "Kicking and Banning people."; SWEP.ViewModel = "models/weapons/v_stunstick.mdl"; SWEP.WorldModel = "models/weapons/w_stunbaton.mdl"; SWEP.AnimPrefix = "admire"; SWEP.Spawnable = false; SWEP.AdminSpawnable = true; SWEP.Primary.ClipSize = -1; SWEP.Primary.DefaultClip = 0; SWEP.Primary.Automatic = false; SWEP.Primary.Ammo = ""; SWEP.Secondary.ClipSize = -1; SWEP.Secondary.DefaultClip = 0; SWEP.Secondary.Automatic = false; SWEP.Secondary.Ammo = ""; function SWEP:Initialize() if (SERVER) then self:SetWeaponHoldType("normal"); end; end; function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire(CurTime() + 1); if (CLIENT) then return; end; local trace = self.Owner:GetEyeTrace(); if (self.Owner:GetPos():Distance( trace.HitPos ) <= 128) then if ( ValidEntity(trace.Entity) and ( trace.Entity:IsPlayer() then ply:Kick("Kicked!") ) end; end; end; end; function SWEP:SecondaryAttack() self.Weapon:SetNextSecondaryFire(CurTime() + 1); if (CLIENT) then return; end; local trace = self.Owner:GetEyeTrace(); if (self.Owner:GetPos():Distance( trace.HitPos ) <= 128) then if ( ValidEntity(trace.Entity) and ( trace.Entity:IsPlayer() then ply:BanId(60, "Banned for 1 hour!") end; end; end; end;[/lua] Probably wont work. Still a rookie at Lua, unfortunately.[/QUOTE] I'll give it a shot.
Sorry, you need to Log In to post a reply to this thread.