Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile("shared.lua")
- end
- if CLIENT then
- SWEP.PrintName = "Lock Pick"
- SWEP.Slot = 2
- SWEP.SlotPos = 1
- SWEP.DrawAmmo = false
- SWEP.DrawCrosshair = false
- end
- SWEP.Author = "HuntsKikBut"
- SWEP.Instructions = "Left Click: Attempt to pick lock."
- SWEP.Contact = ""
- SWEP.Purpose = ""
- SWEP.HoldType = "melee";
- SWEP.ViewModel = "models/weapons/v_crowbar.mdl";
- SWEP.WorldModel = "models/weapons/w_crowbar.mdl";
- SWEP.ViewModelFOV = 62
- SWEP.ViewModelFlip = false
- SWEP.AnimPrefix = "melee"
- SWEP.BreakSound = "doors/handle_pushbar_locked1.wav"
- SWEP.BatterSound = "doors/door_locked2.wav"
- SWEP.BreakSelfChance = 15;
- SWEP.PercentChance = 8;
- 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()
- self:SetWeaponHoldType("melee")
- end
- function SWEP:CanPrimaryAttack ( ) return true; end
- function SWEP:TryToBatter ( Target )
- if Target:GetDoorOwner() == self.Owner then
- self.Owner:Notify('You pick open your own doors. Use a key!');
- return false;
- if (SERVER) then
- if (Target:GetDoorOwner()!=nil and Target:GetDoorOwner() == self.Owner) then
- if Target:GetDoorOwner():GetPlayTime()<36000 then
- if Target:GetDoorOwner():GetTable().RoleplayData.Organization==0 then
- if #Target:GetDoorOwner():GetTable().RoleplayData.Buddies==0 then
- self.Owner:Notify("You try to raid a noob. Shame on you.")
- return false;
- end
- if #Target:GetDoorOwner().RoleplayData.Buddies<3 then
- for k,v in pairs(Target:GetDoorOwner():GetTable().RoleplayData.Buddies) do
- if v:GetPlayTime()>36000 then
- local Noob=false
- end
- end
- if (Noob==false) then
- self.Owner:Notify("You try to raid a noob. Shame on you.")
- return false;
- end
- end
- end
- end
- end
- end
- self:EmitSound(self.BatterSound);
- if self.Owner:GetSkillLevel('strength') > 3 then
- self.BreakSelfChance = self.BreakSelfChance - 5
- self.PercentChance = self.PercentChance + 5
- end
- local function whatlol ( )
- if !self or !self:IsValid() then return false; end
- local EyeTrace = self.Owner:GetEyeTrace()
- if !EyeTrace.Entity:IsValid() or !(EyeTrace.Entity:IsDoor() and EyeTrace.Entity:IsOwnable()) then
- self.Owner:Notify('You lost your focus');
- return false;
- end
- local Randomness = math.random(1, 100);
- local SetOffHouseAlarm = true;
- if Randomness <= self.BreakSelfChance then
- self:Brake();
- elseif Randomness <= self.BreakSelfChance + self.PercentChance then
- Target:Fire('unlock', '', 0);
- Target:Fire('open', '', .5);
- Target:SetNWBool("DoorLock", false)
- Target:SetNWInt("PixLoxTime", CurTime())
- SetOffHouseAlarm = false;
- if IsValid(self.Owner) then
- self.Owner:AddProgress(32, 1);
- end
- end
- if SetOffHouseAlarm then
- local Group = Target:GetDoorGroup();
- if GAMEMODE.HouseAlarms[Group] and (!Target:GetTable().LastSirenPlay or Target:GetTable().LastSirenPlay + 30 < CurTime()) and Target:GetDoorOwner() and Target:GetDoorOwner():IsValid() and Target:GetDoorOwner():IsPlayer() then
- umsg.Start('perp_house_alarm');
- umsg.Entity(Target);
- umsg.End();
- local LocationText = Target:GetLocationText();
- umsg.Start('PE_CUSTOMCHAT', Target:GetDoorOwner());
- umsg.Entity(Target:GetDoorOwner());
- umsg.String('[ Burglar Alarm ] A break in has occurred at ' .. LocationText .. '. Police requested.');
- umsg.Short(CHAT_911);
- umsg.End();
- for k, v in pairs(player.GetAll()) do
- if v:Team() == TEAM_POLICE or v:Team() == TEAM_FIREMAN or v:Team() == TEAM_MAYOR or v:Team() == TEAM_PARAMEDIC or v:Team() == TEAM_SWAT then
- umsg.Start('PE_CUSTOMCHAT', v);
- umsg.Entity(Target:GetDoorOwner());
- umsg.String('[ Burglar Alarm ] A break in has occurred at ' .. LocationText .. '. Police requested.');
- umsg.Short(CHAT_911);
- umsg.End();
- end
- end
- Target:GetTable().LastSirenPlay = CurTime()
- end
- end
- end
- if SERVER then
- timer.Simple(1.5, whatlol);
- end
- end
- function SWEP:PrimaryAttack()
- local EyeTrace = self.Owner:GetEyeTrace()
- if !EyeTrace.Entity:IsValid() or !(EyeTrace.Entity:IsDoor() and EyeTrace.Entity:IsOwnable()) then return false; end
- local Distance = self.Owner:EyePos():Distance(EyeTrace.HitPos);
- if Distance > 75 then return false; end
- self:TryToBatter(EyeTrace.Entity);
- self.Weapon:SetNextPrimaryFire(CurTime() + 3)
- self.Weapon:SetNextSecondaryFire(CurTime() + 3)
- end
- function SWEP:SecondaryAttack()
- self:PrimaryAttack();
- end
- function SWEP:Brake()
- for k,v in pairs(self.Owner:GetTable().weaponsEquipped) do
- if v=='weapon_lock_pick' then
- table.remove(self.Owner:GetTable().weaponsEquipped,k);
- end
- end
- self:EmitSound(self.BreakSound);
- self.Owner:Notify('Your lock pick broke!');
- self:Remove();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement