From 21298851623731ce5534f2ddebceced6f1fd1d42 Mon Sep 17 00:00:00 2001 From: edshot99 Date: Sat, 21 Dec 2024 02:04:07 -0600 Subject: [PATCH] import files from workshop --- .../lua/autorun/m9k_specialties_11_07_15.lua | 487 ++++++++++++++++++ .../m9k_launched_davycrockett/shared.lua | 142 +++++ .../lua/weapons/m9k_davy_crockett/shared.lua | 301 +++++++++++ .../lua/weapons/m9k_orbital_strike/shared.lua | 193 +++++++ 4 files changed, 1123 insertions(+) create mode 100644 m9k_specialties_fatal_edition/lua/autorun/m9k_specialties_11_07_15.lua create mode 100644 m9k_specialties_fatal_edition/lua/entities/m9k_launched_davycrockett/shared.lua create mode 100644 m9k_specialties_fatal_edition/lua/weapons/m9k_davy_crockett/shared.lua create mode 100644 m9k_specialties_fatal_edition/lua/weapons/m9k_orbital_strike/shared.lua diff --git a/m9k_specialties_fatal_edition/lua/autorun/m9k_specialties_11_07_15.lua b/m9k_specialties_fatal_edition/lua/autorun/m9k_specialties_11_07_15.lua new file mode 100644 index 0000000..b3b4604 --- /dev/null +++ b/m9k_specialties_fatal_edition/lua/autorun/m9k_specialties_11_07_15.lua @@ -0,0 +1,487 @@ +/*------------------------------------------------------ + +If you're reading this, then that mean's you've extracted this addon, probably with intentions +of editing it for your own needs, or that you're using a legacy addon. + +I have no problem with that, but you must understand that I cannot offer support for legacy addons. +If you've extracted this addon, I cannot offer any help fixing problems that come up. It's impossible +to know what you've changed, and thus impossible to know what to fix. + +"But Bob!" you might say. "I only changed one thing!" + +Well, that's a shame. Everybody is going to say this, and I know that some of those people will be +lying to me. The only thing I can do is to refuse support to everyone using legacy addons. + +So, by using a legacy addon, you accept the fact that I cannot help fix anything that might be broken. + +I know it's tough love, but that's the way it's got to be. + +------------------------------------------------------*/ + +local icol = Color( 255, 255, 255, 255 ) +if CLIENT then + killicon.Add( "m9k_thrown_sticky_grenade", "vgui/hud/m9k_sticky_grenade", icol ) + killicon.Add( "m9k_thrown_m61", "vgui/hud/m9k_m61_frag", icol ) + killicon.Add( "m9k_m61_frag", "vgui/hud/m9k_m61_frag", icol ) + killicon.Add( "m9k_thrown_knife", "vgui/hud/m9k_machete", icol ) + killicon.Add( "m9k_thrown_harpoon", "vgui/hud/m9k_harpoon", icol ) + killicon.Add( "m9k_sent_nuke_radiation", "vgui/hud/m9k_davy_crockett", icol ) + killicon.Add( "m9k_released_poison", "vgui/hud/m9k_nerve_gas", icol ) + killicon.Add( "m9k_poison_parent", "vgui/hud/m9k_nerve_gas", icol ) + killicon.Add( "m9k_sent_nuke_radiation", "vgui/hud/m9k_davy_crockett", icol ) + killicon.Add( "m9k_davy_crockett_explo", "vgui/hud/m9k_davy_crockett", icol ) + killicon.Add( "m9k_proxy", "vgui/hud/m9k_proxy_mine", icol ) + killicon.Add( "m9k_milkor_nade", "vgui/hud/m9k_milkormgl", icol ) + killicon.Add( "m9k_suicide_bomb", "vgui/hud/m9k_suicide_bomb", icol ) + killicon.Add( "m9k_mad_c4", "vgui/hud/m9k_suicide_bomb", icol ) + killicon.Add( "m9k_m202_rocket", "vgui/hud/m9k_m202", icol ) + killicon.Add( "m9k_launched_m79", "vgui/hud/m9k_m79gl", icol ) + killicon.Add( "m9k_improvised_explosive", "vgui/hud/m9k_ied_detonator", icol ) + killicon.Add( "m9k_gdcwa_matador_90mm", "vgui/hud/m9k_matador", icol ) + killicon.Add( "m9k_gdcwa_rpg_heat", "vgui/hud/m9k_rpg7", icol ) + killicon.Add( "m9k_damascus", "vgui/hud/m9k_damascus", icol ) + killicon.Add( "m9k_fists", "vgui/hud/m9k_fists", icol ) + killicon.Add( "m9k_machete", "vgui/hud/m9k_machete", icol ) + killicon.Add( "m9k_launched_ex41", "vgui/hud/m9k_ex41", icol ) + killicon.Add( "m9k_oribital_cannon", "vgui/hud/m9k_orbital_strike", icol ) + killicon.Add( "m9k_knife", "vgui/hud/m9k_knife", icol ) + killicon.Add( "m9k_thrown_spec_knife", "vgui/hud/m9k_knife", icol ) + killicon.Add( "m9k_nitro_vapor", "vgui/hud/m9k_nitro", icol ) + + language.Add("40mmGrenade_ammo", "40mm Grenade") + language.Add("C4Explosive_ammo", "C4") + language.Add("ProxMine_ammo", "Proximity Mine") + language.Add("Improvised_Explosive_ammo", "Improvised Explosive Device") + language.Add("Nuclear_Warhead_ammo", "Nuclear Warhead") + language.Add("NerveGas_ammo", "Nerve Gas") + language.Add("StickyGrenade_ammo", "Sticky Grenade") + language.Add("SatCannon_ammo", "Orbital Strike Cannon") + language.Add("Harpoon_ammo", "Harpoon") + language.Add("nitroG_ammo", "Nitro") +end + +--I'm pretty sure we don't need these anymore... +--Almost 99 percent sure that's I'm 100 percent sure... + +-- if GetConVar("M9KDisableHolster") == nil then + -- CreateConVar("M9KDisableHolster", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Disable my totally worthless and broken holster system? Won't hurt my feelings any. 1 for true, 2 for false. A map change may be required.") + -- print("Holster Disable con var created") +-- end + +if GetConVar("DebugM9K") == nil then + CreateConVar("DebugM9K", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "Debugging for some m9k stuff, turning it on won't change much.") +end + +if GetConVar("M9KWeaponStrip") == nil then + CreateConVar("M9KWeaponStrip", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Allow empty weapon stripping? 1 for true, 0 for false") + print("Weapon Strip con var created") +end + +if GetConVar("M9KDisablePenetration") == nil then + CreateConVar("M9KDisablePenetration", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Disable Penetration and Ricochets? 1 for true, 0 for false") + print("Penetration/ricochet con var created") +end + +if GetConVar("M9KDynamicRecoil") == nil then + CreateConVar("M9KDynamicRecoil", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Use Aim-modifying recoil? 1 for true, 0 for false") + print("Recoil con var created") +end + +if GetConVar("M9KAmmoDetonation") == nil then + CreateConVar("M9KAmmoDetonation", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Enable detonatable M9K Ammo crates? 1 for true, 0 for false.") + print("Ammo crate detonation con var created") +end + +if GetConVar("M9KDamageMultiplier") == nil then + CreateConVar("M9KDamageMultiplier", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Multiplier for M9K bullet damage.") + print("Damage Multiplier con var created") +end + +if GetConVar("M9KDefaultClip") == nil then + CreateConVar("M9KDefaultClip", "-1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "How many clips will a weapon spawn with? Negative reverts to default values.") + print("Default Clip con var created") +end + +if GetConVar("M9KUniqueSlots") == nil then + CreateConVar("M9KUniqueSlots", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Give M9K Weapons unique slots? 1 for true, 2 for false. A map change may be required.") + print("Unique Slots con var created") +end + +if GetConVar("M9KExplosiveNerveGas") == nil then + CreateConVar("M9KExplosiveNerveGas", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Use silent explosions for nerve gas? Doesn't clip through walls, but does make other things explode.") + print("Explosive Nerve Gas con var created") +end + +if GetConVar("M9K_Davy_Crockett_Timer") == nil then + CreateConVar("M9K_Davy_Crockett_Timer", "3", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Time to make Davy Crockett holder wait before firing the weapon.") + print("Davy Crockett timer created") +end + +if GetConVar("DavyCrockettAllowed") == nil then + CreateConVar("DavyCrockettAllowed", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Allow people to shoot the Davy Crockett?") + if (GetConVar("DebugM9K"):GetBool()) then print("m9k_davy_crockett blacklist convar created!") end +end + +if GetConVar("DavyCrocketAdminOnly") == nil then + CreateConVar("DavyCrocketAdminOnly", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Make the Davy Crockett an Admin Only weapon?") + if (GetConVar("DebugM9K"):GetBool()) then print("DavyCrocketAdminOnly convar created!") end +end + +if GetConVar("OrbitalStrikeAdminOnly") == nil then + CreateConVar("OrbitalStrikeAdminOnly", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Make the Orbital Cannon an Admin Only weapon?") + if (GetConVar("DebugM9K"):GetBool()) then print("OrbitalStrikeAdminOnly convar created!") end +end + +if !game.SinglePlayer() then + + if GetConVar("M9KClientGasDisable") == nil then + CreateConVar("M9KClientGasDisable", "0", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Turn off gas effect for all clients? 1 for yes, 0 for no. ") + end + + if SERVER then + + function ClientSideGasDisabler() + timer.Create("ClientGasBroadcastTimer", 15, 0, + function() BroadcastLua("RunConsoleCommand(\"M9KGasEffect\", \"0\")") end ) + end + + if GetConVar("M9KClientGasDisable"):GetBool() then + ClientSideGasDisabler() + end + + function M9K_Svr_Gas_Change_Callback(cvar, previous, new) + if tobool(new) == true then + ClientSideGasDisabler() + BroadcastLua("print(\"Gas effects disabled on this server!\")") + elseif tobool(new) == false then + BroadcastLua("print(\"Gas effects re-enabled on this server.\")") + BroadcastLua("print(\"You may turn on M9KGasEffect if you wish.\")") + if timer.Exists("ClientGasBroadcastTimer") then + timer.Destroy("ClientGasBroadcastTimer") + end + end + end + cvars.AddChangeCallback("M9KClientGasDisable", M9K_Svr_Gas_Change_Callback) + + end + + if CLIENT then + if GetConVar("M9KGasEffect") == nil then + CreateClientConVar("M9KGasEffect", "1", true, true) + print("Client-side Gas Effect Con Var created") + end + end + +else + if GetConVar("M9KGasEffect") == nil then + CreateConVar("M9KGasEffect", "1", { FCVAR_REPLICATED, FCVAR_NOTIFY, FCVAR_ARCHIVE }, "Use gas effect when shooting? 1 for true, 0 for false") + print("Gas effect con var created") + end +end + +game.AddAmmoType( { + name = "SatCannon", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "40mmGrenade", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "C4Explosive", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "ProxMine", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "Improvised_Explosive", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "Nuclear_Warhead", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "NerveGas", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "StickyGrenade", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "Harpoon", + dmgtype = DMG_BULLET +} ) + +game.AddAmmoType( { + name = "nitroG", + dmgtype = DMG_BULLET +} ) + +game.AddParticles("particles/nitro_main.pcf") + +if GetConVarString("nuke_yield") == nil then --if one of them doesn't exists, then they all probably don't exist + CreateConVar("nuke_yield", 200, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_.mp3eresolution", 0.2, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_ignoreragdoll", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_breakconstraints", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_disintegration", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_damage", 100, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_epic_blast.mp3e", 1, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_radiation_duration", 0, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) + CreateConVar("nuke_radiation_damage", 0, { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "nuke variables" ) +end + +function GuardUp(victim, info) + + if not IsValid(victim) then return end + if not victim:IsPlayer() then return end + if not IsValid(victim:GetActiveWeapon()) then return end + if not IsValid(info:GetAttacker()) then return end + if not IsValid(info:GetInflictor()) then return end + + if info:GetInflictor():GetClass() == "m9k_damascus" then + if victim:IsPlayer() and victim:Alive() then + if victim:GetNWBool("GuardIsUp", false) and victim:GetActiveWeapon():GetClass() == "m9k_damascus" then + info:SetDamage(0) + victim:EmitSound(Sound("weapons/blades/clash.mp3")) + else + victim:EmitSound(Sound("weapons/blades/swordchop.mp3")) + end + else + victim:EmitSound(Sound("weapons/blades/swordchop.mp3")) + end + end + +end +hook.Add("EntityTakeDamage", "GuardUp", GuardUp ) + +function DukesUp(victim, info) + if not IsValid(victim) then return end + if not victim:IsPlayer() then return end + if not IsValid(victim:GetActiveWeapon()) then return end + if not IsValid(info:GetAttacker()) then return end + if not IsValid(info:GetInflictor()) then return end + + if victim:IsPlayer() and victim:Alive() then + if victim:GetActiveWeapon():GetClass() == "m9k_fists" then + if victim:GetNWBool("DukesAreUp", false) and info:GetDamageType() == DMG_CLUB then + info:SetDamage(1) + end + end + end + +end +hook.Add("EntityTakeDamage", "DukesUp", DukesUp ) +--thanks for sharing the information i needed to fix this, intox! + +function PoisonChildChecker(victim, info) + + if !IsValid(victim) then return end + if not IsValid(info:GetAttacker()) then return end + if not IsValid(info:GetInflictor()) then return end + + if info:GetInflictor() != nil then + if info:GetInflictor():GetClass() == "POINT_HURT" then + dealer = info:GetInflictor() + if IsValid(dealer:GetParent()) then + dealerParent = dealer:GetParent() + if dealerParent:GetClass() == "m9k_poison_parent" then + if IsValid(dealerParent:GetOwner()) then + info:SetAttacker(dealerParent:GetOwner()) + info:SetInflictor(dealerParent) + end + end + end + end + end + +end +hook.Add("EntityTakeDamage", "PoisonChildChecker", PoisonChildChecker ) + +//EX41 +sound.Add({ + name = "EX41.Pump", + channel = CHAN_ITEM, + volume = 1, + sound = "weapons/ex41/m3_pump.mp3" +}) + +sound.Add({ + name = "EX41.Insertshell", + channel = CHAN_ITEM, + volume = 1, + sound = "weapons/ex41/m3_insertshell.mp3" +}) + +sound.Add({ + name = "EX41.Draw", + channel = CHAN_ITEM, + volume = 1, + sound = "weapons/ex41/draw.mp3" +}) + +//RPG +sound.Add({ + name = "RPGF.single", + channel = CHAN_USER_BASE+10, + volume = 1.0, + soundlevel = 155, + sound = "GDC/Rockets/RPGF.wav" +}) + +sound.Add({ + name = "M202F.single", + channel = CHAN_USER_BASE+10, + volume = 1.0, + soundlevel = 155, + sound = {"GDC/Rockets/M202F.wav", "gdc/rockets/m202f2.wav"} +}) + +sound.Add({ + name = "MATADORF.single", + channel = CHAN_USER_BASE+10, + volume = 1.0, + soundlevel = 155, + sound = "GDC/Rockets/MATADORF.wav" +}) + +//Suicide bomb +sound.Add({ + name = "sb.click", + channel = CHAN_USER_BASE+10, + volume = "1", + sound = "weapons/suicidebomb/c4_click.mp3" +}) + +// m79 grenade launcher + +sound.Add({ + name = "M79_launcher.close", + channel = CHAN_ITEM, + volume = 1.0, + sound = "weapons/M79/m79_close.mp3" + +}) + +sound.Add({ + name = "M79_glauncher.barrelup",//GET THIS SOUND! + channel = CHAN_ITEM, + volume = 1.0, + sound = "weapons/M79/barrelup.mp3" + +}) + +sound.Add({ + name = "M79_glauncher.InsertShell",//GET THIS SOUND! + channel = CHAN_ITEM, + volume = 1.0, + sound = "weapons/M79/xm_insert.mp3" + +}) + +sound.Add({ + name = "M79_launcher.draw" , + channel = CHAN_ITEM, + volume = 1.0, + sound = "weapons/M79/m79_close.mp3" + +}) + +sound.Add({ + name = "40mmGrenade.Single" , + channel = CHAN_USER_BASE+10, + volume = 1.0, + sound = "weapons/M79/40mmthump.wav" + +}) + +m9knpw = {} +table.insert(m9knpw, "m9k_davy_crockett_explo") +table.insert(m9knpw, "m9k_gdcwa_matador_90mm") +table.insert(m9knpw, "m9k_gdcwa_rpg_heat") +table.insert(m9knpw, "m9k_improvised_explosive") +table.insert(m9knpw, "m9k_launched_davycrockett") +table.insert(m9knpw, "m9k_launched_ex41") +table.insert(m9knpw, "m9k_launched_m79") +table.insert(m9knpw, "m9k_m202_rocket") +table.insert(m9knpw, "m9k_mad_c4") +table.insert(m9knpw, "m9k_milkor_nade") +table.insert(m9knpw, "m9k_nervegasnade") +table.insert(m9knpw, "m9k_nitro_vapor") +table.insert(m9knpw, "m9k_oribital_cannon") +table.insert(m9knpw, "m9k_poison_parent") +table.insert(m9knpw, "m9k_proxy") +table.insert(m9knpw, "m9k_released_poison") +table.insert(m9knpw, "m9k_sent_nuke_radiation") +table.insert(m9knpw, "m9k_thrown_harpoon") +table.insert(m9knpw, "m9k_thrown_knife") +table.insert(m9knpw, "m9k_thrown_m61") +table.insert(m9knpw, "m9k_thrown_nitrox") +table.insert(m9knpw, "m9k_thrown_spec_knife") +table.insert(m9knpw, "m9k_thrown_sticky_grenade") +table.insert(m9knpw, "bb_dod_bazooka_rocket") +table.insert(m9knpw, "bb_dod_panzershreck_rocket") +table.insert(m9knpw, "bb_garand_riflenade") +table.insert(m9knpw, "bb_k98_riflenade") +table.insert(m9knpw, "bb_planted_dod_tnt") +table.insert(m9knpw, "bb_thrownalliedfrag") +table.insert(m9knpw, "bb_thrownaxisfrag") +table.insert(m9knpw, "bb_thrownsmoke_axis") +table.insert(m9knpw, "bb_thrownaxisfrag") +table.insert(m9knpw, "bb_planted_alt_c4") +table.insert(m9knpw, "bb_planted_css_c4") +table.insert(m9knpw, "bb_throwncssfrag") +table.insert(m9knpw, "bb_throwncsssmoke") +table.insert(m9knpw, "m9k_ammo_40mm") +table.insert(m9knpw, "m9k_ammo_40mm_single") +table.insert(m9knpw, "m9k_ammo_357") +table.insert(m9knpw, "m9k_ammo_ar2") +table.insert(m9knpw, "m9k_ammo_buckshot") +table.insert(m9knpw, "m9k_ammo_c4") +table.insert(m9knpw, "m9k_ammo_frags") +table.insert(m9knpw, "m9k_ammo_ieds") +table.insert(m9knpw, "m9k_ammo_nervegas") +table.insert(m9knpw, "m9k_ammo_nuke") +table.insert(m9knpw, "m9k_ammo_pistol") +table.insert(m9knpw, "m9k_ammo_proxmines") +table.insert(m9knpw, "m9k_ammo_rockets") +table.insert(m9knpw, "m9k_ammo_smg") +table.insert(m9knpw, "m9k_ammo_sniper_rounds") +table.insert(m9knpw, "m9k_ammo_stickynades") +table.insert(m9knpw, "m9k_ammo_winchester") + +function PocketM9KWeapons(ply, wep) + + if not IsValid(wep) then return end + class = wep:GetClass() + m9knopocket = false + + for k, v in pairs(m9knpw) do + if v == class then + m9knopocket = true + break + end + end + + if m9knopocket then + return false + end + + --goddammit i hate darkrp + +end +hook.Add("canPocket", "PocketM9KWeapons", PocketM9KWeapons ) + +specialties_autorun_mounted = true \ No newline at end of file diff --git a/m9k_specialties_fatal_edition/lua/entities/m9k_launched_davycrockett/shared.lua b/m9k_specialties_fatal_edition/lua/entities/m9k_launched_davycrockett/shared.lua new file mode 100644 index 0000000..771ce5f --- /dev/null +++ b/m9k_specialties_fatal_edition/lua/entities/m9k_launched_davycrockett/shared.lua @@ -0,0 +1,142 @@ + ENT.Type = "anim" + ENT.PrintName = "" + ENT.Author = "" + ENT.Contact = "" + ENT.Purpose = "" + ENT.Instructions = "LAUNCH" + +ENT.Spawnable = false +ENT.AdminOnly = true +ENT.DoNotDuplicate = true +ENT.DisableDuplicator = true + +if SERVER then + +AddCSLuaFile( "shared.lua" ) + +function ENT:Initialize() + self.CanTool = false + +self.flightvector = self.Entity:GetUp() * ((115*52.5)/66) +self.timeleft = CurTime() + 5 +self.Owner = self.Entity.Owner +self.Entity:SetModel( "models/failure/mk6/m62.mdl" ) +self.Entity:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics, +self.Entity:SetMoveType( MOVETYPE_NONE ) --after all, gmod is a physics +self.Entity:SetSolid( SOLID_VPHYSICS ) -- CHEESECAKE! >:3 +self.Entity:SetColor(Color(82,102,39,254)) + +Glow = ents.Create("env_sprite") +Glow:SetKeyValue("model","orangecore2.vmt") +Glow:SetKeyValue("rendercolor","255 150 100") +Glow:SetKeyValue("scale","0.3") +Glow:SetPos(self.Entity:GetPos()) +Glow:SetParent(self.Entity) +Glow:Spawn() +Glow:Activate() +self.Entity:SetNWBool("smoke", true) +end + + function ENT:Think() + + if not IsValid(self) then return end + if not IsValid(self.Entity) then return end + + if self.timeleft < CurTime() then + if not IsValid(self.Owner) then + self.Entity:Remove() + return + end + + local nuke = ents.Create("m9k_davy_crockett_explo") + nuke:SetPos( self.Entity:GetPos() ) + nuke:SetOwner(self.Owner) + nuke:Spawn() + nuke:Activate() + self.Entity:Remove() + end + + Table ={} //Table name is table name + Table[1] =self.Owner //The person holding the gat + Table[2] =self.Entity //The cap + + local trace = {} + trace.start = self.Entity:GetPos() + trace.endpos = self.Entity:GetPos() + self.flightvector + trace.filter = Table + local tr = util.TraceLine( trace ) + + + if tr.HitSky then + if not IsValid(self.Owner) then + self.Entity:Remove() + return + end + local nuke = ents.Create("m9k_davy_crockett_explo") + nuke:SetPos( self.Entity:GetPos() ) + nuke:SetOwner(self.Entity.Owner) + nuke.Owner = self.Entity.Owner + nuke:Spawn() + nuke:Activate() + self.Entity:Remove() + self.Entity:SetNWBool("smoke", false) + end + + if tr.Hit then + if not IsValid(self.Owner) then + self.Entity:Remove() + return + end + local nuke = ents.Create("m9k_davy_crockett_explo") + nuke:SetPos( self.Entity:GetPos() ) + nuke:SetOwner(self.Entity.Owner) + nuke.Owner = self.Entity.Owner + nuke:Spawn() + nuke:Activate() + self.Entity:Remove() + self.Entity:SetNWBool("smoke", false) + end + + self.Entity:SetPos(self.Entity:GetPos() + self.flightvector) + self.flightvector = self.flightvector - self.flightvector/((147*39.37)/66) + self.Entity:GetUp()*2 + Vector(math.Rand(-0.3,0.3), math.Rand(-0.3,0.3),math.Rand(-0.1,0.1)) + Vector(0,0,-0.111) + self.Entity:SetAngles(self.flightvector:Angle() + Angle(90,0,0)) + self.Entity:NextThink( CurTime() ) + return true + +end + +end + +if CLIENT then + function ENT:Draw() + self.Entity:DrawModel() // Draw the model. + end + +function ENT:Initialize() + pos = self:GetPos() + self.emitter = ParticleEmitter( pos ) + end + + function ENT:Think() + if (self.Entity:GetNWBool("smoke")) then + pos = self:GetPos() + for i=0, (10) do + local particle = self.emitter:Add( "particle/smokesprites_000"..math.random(1,9), pos + (self:GetUp() * -100 * i)) + if (particle) then + particle:SetVelocity((self:GetUp() * -2000) ) + particle:SetDieTime( math.Rand( 2, 5 ) ) + particle:SetStartAlpha( math.Rand( 5, 8 ) ) + particle:SetEndAlpha( 0 ) + particle:SetStartSize( math.Rand( 40, 50 ) ) + particle:SetEndSize( math.Rand( 130, 150 ) ) + particle:SetRoll( math.Rand(0, 360) ) + particle:SetRollDelta( math.Rand(-1, 1) ) + particle:SetColor( 200 , 200 , 200 ) + particle:SetAirResistance( 200 ) + particle:SetGravity( Vector( 100, 0, 0 ) ) + end + + end + end +end +end \ No newline at end of file diff --git a/m9k_specialties_fatal_edition/lua/weapons/m9k_davy_crockett/shared.lua b/m9k_specialties_fatal_edition/lua/weapons/m9k_davy_crockett/shared.lua new file mode 100644 index 0000000..dc371a8 --- /dev/null +++ b/m9k_specialties_fatal_edition/lua/weapons/m9k_davy_crockett/shared.lua @@ -0,0 +1,301 @@ +-- Variables that are used on both client and server +SWEP.Gun = ("m9k_davy_crockett") -- must be the name of your swep but NO CAPITALS! +if (GetConVar("DavyCrockettAllowed")) == nil then + print("Blacklist Convar for "..SWEP.Gun.." is missing! You may have hit the lua limit, or incorrectly modified the autorun file!") +elseif not (GetConVar("DavyCrockettAllowed"):GetBool()) then SWEP.Base = "bobs_blacklisted" SWEP.PrintName = SWEP.Gun return end +SWEP.Category = "M9K Specialties" +SWEP.Author = "" +SWEP.Contact = "" +SWEP.Purpose = "" +SWEP.Instructions = "" +SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models +SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models +SWEP.PrintName = "Davy Crockett" -- Weapon name (Shown on HUD) +SWEP.Slot = 4 -- Slot in the weapon selection menu +SWEP.SlotPos = 31 -- Position in the slot +SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter +SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box +SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce? +SWEP.DrawCrosshair = false -- set false if you want no crosshair +SWEP.Weight = 30 -- rank relative ot other weapons. bigger is better +SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up +SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon +SWEP.HoldType = "rpg" -- how others view you carrying the weapon +-- normal melee melee2 fist knife smg ar2 pistol rpg physgun grenade shotgun crossbow slam passive +-- you're mostly going to use ar2, smg, shotgun or pistol. rpg and ar2 make for good sniper rifles + +SWEP.ViewModelFOV = 70 +SWEP.ViewModelFlip = false +SWEP.ViewModel = "models/weapons/v_RL7.mdl" -- Weapon view model +SWEP.WorldModel = "models/weapons/w_RL7.mdl" -- Weapon world model +SWEP.Base = "bobs_gun_base" +SWEP.Spawnable = true +SWEP.AdminSpawnable = true +SWEP.FiresUnderwater = true + +SWEP.Primary.Sound = Sound("") -- Script that calls the primary fire sound +SWEP.Primary.RPM = 20 -- This is in Rounds Per Minute +SWEP.Primary.ClipSize = 1 -- Size of a clip +SWEP.Primary.DefaultClip = 1 -- Bullets you start with +SWEP.Primary.KickUp = 0 -- Maximum up recoil (rise) +SWEP.Primary.KickDown = 0 -- Maximum down recoil (skeet) +SWEP.Primary.KickHorizontal = 0 -- Maximum up recoil (stock) +SWEP.Primary.Automatic = false -- Automatic = true; Semi Auto = false +SWEP.Primary.Ammo = "Nuclear_Warhead" +-- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun +-- Pistol, buckshot, and slam always ricochet. Use AirboatGun for a metal peircing shotgun slug + +SWEP.Primary.Round = ("m9k_launched_davycrockett") --NAME OF ENTITY GOES HERE + +SWEP.Secondary.IronFOV = 40 -- How much you 'zoom' in. Less is more! + +SWEP.Primary.NumShots = 0 -- How many bullets to shoot per trigger pull +SWEP.Primary.Damage = 0 -- Base damage per bullet +SWEP.Primary.Spread = 0 -- Define from-the-hip accuracy (1 is terrible, .0001 is exact) +SWEP.Primary.IronAccuracy = 0 -- Ironsight accuracy, should be the same for shotguns +--none of this matters for IEDs and other ent-tossing sweps + +-- Enter iron sight info and bone mod info below +SWEP.IronSightsPos = Vector (-3.7384, -5.7481, -0.2713) +SWEP.IronSightsAng = Vector (1.1426, 0.0675, 0) +SWEP.SightsPos = Vector (-3.7384, -5.7481, -0.2713) +SWEP.SightsAng = Vector (1.1426, 0.0675, 0) +SWEP.RunSightsPos = Vector (2.4946, -1.5644, 1.699) +SWEP.RunSightsAng = Vector (-20.1104, 35.1164, -12.959) + + +if GetConVar("M9K_Davy_Crockett_Timer") == nil then +SWEP.NextFireTime = 3 +SWEP.Countdown = 3 +print("M9K_Davy_Crockett_Timer con var is missing! You may have a corrupt addon, or hit the lua limit.") +else +SWEP.NextFireTime = GetConVarNumber("M9K_Davy_Crockett_Timer") +SWEP.Countdown = GetConVarNumber("M9K_Davy_Crockett_Timer") +end + +SWEP.FireDelay = SWEP.NextFireTime + +--and now to the nasty parts of this swep... +function SWEP:Deploy() + + if timer.Exists("davy_crocket_"..self.Owner:UniqueID()) then + timer.Destroy("davy_crocket_"..self.Owner:UniqueID()) + end + self:SetIronsights(false, self.Owner) -- Set the ironsight false + self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) + + if (GetConVar("DavyCrockettAllowed"):GetBool()) then + self.FireDelay = (CurTime() + self.NextFireTime) + self.Owner:PrintMessage( HUD_PRINTCENTER, "Warhead will be armed in "..self.Countdown.." seconds." ) + self.Owner.DCCount = self.Countdown - 1 + timer.Create("davy_crocket_"..self.Owner:UniqueID(), 1, self.Countdown, + function() + if not IsValid(self) then return end + if not IsValid(self.Owner) then return end + if not IsValid(self.Weapon) then return end + if not IsValid(self.Owner:GetActiveWeapon()) then return end + if self.Owner:GetActiveWeapon():GetClass() != self.Gun then timer.Destroy("davy_crocket_"..self.Owner:UniqueID()) return end + self:DeployCountDownFunc(self.Owner.DCCount) + self.Owner.DCCount = self.Owner.DCCount - 1 + end) + else + self.Owner:PrintMessage( HUD_PRINTCENTER, "Nukes are not allowed on this server." ) + end + + if !self.Owner:IsNPC() then + self.ResetSights = CurTime() + self.Owner:GetViewModel():SequenceDuration() + end + + self:SetHoldType(self.HoldType) + self.Weapon:SetNWBool("Reloading", false) + return true +end + +function SWEP:DeployCountDownFunc(count) + if not IsValid(self) then return end + if not IsValid(self.Owner) then return end + if not IsValid(self.Weapon) then return end + if self.Owner:GetActiveWeapon():GetClass() != self.Gun then timer.Destroy("davy_crocket_"..self.Owner:UniqueID()) return end + if count == 0 then + self.Owner:PrintMessage(HUD_PRINTTALK, "WARHEAD IS ARMED AND READY TO FIRE" ) + elseif count == 1 then + self.Owner:PrintMessage(HUD_PRINTTALK, count.." second remaining!" ) + else + self.Owner:PrintMessage(HUD_PRINTTALK, count.." seconds remaining" ) + end + if count <= 5 then + self.Weapon:EmitSound("C4.PlantSound") + end +end + +function SWEP:PrimaryAttack() + if self:CanPrimaryAttack() and self.FireDelay <= CurTime() and not self.Owner:KeyPressed(IN_SPEED) then + if self.Owner:IsPlayer() then + if GetConVar("DavyCrockettAllowed") == nil or (GetConVar("DavyCrockettAllowed"):GetBool()) then + self:FireRocket() + self.Weapon:EmitSound("RPGF.single") + self.Weapon:TakePrimaryAmmo(1) + self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) + self.Owner:SetAnimation( PLAYER_ATTACK1 ) + self.Owner:MuzzleFlash() + self.Weapon:SetNextPrimaryFire(CurTime()+1/(self.Primary.RPM/60)) + else + self.Owner:PrintMessage( HUD_PRINTCENTER, "Nukes are not allowed on this server." ) + end + end + self:CheckWeaponsAndAmmo() + end +end + +function SWEP:FireRocket() + local aim = self.Owner:GetAimVector() + local pos = self.Owner:GetShootPos() + + if SERVER then + local rocket = ents.Create(self.Primary.Round) + if !rocket:IsValid() then return false end + rocket:SetAngles(aim:Angle()+Angle(90,0,0)) + rocket:SetPos(pos) + rocket:SetOwner(self.Owner) + rocket.Owner = self.Owner + rocket:Spawn() + rocket:Activate() + end +end + +function SWEP:SecondaryAttack() +end + +function SWEP:CheckWeaponsAndAmmo() + if SERVER and self.Weapon != nil then + if self.Weapon:Clip1() == 0 && self.Owner:GetAmmoCount( self.Weapon:GetPrimaryAmmoType() ) == 0 and (GetConVar("M9KWeaponStrip"):GetBool()) then + timer.Simple(.1, function() if SERVER then if not IsValid(self) then return end + if not IsValid(self.Owner) then return end + self.Owner:StripWeapon(self.Gun) + end end) + else + self:Reload() + end + end +end + +function SWEP:Holster() + + if CLIENT and IsValid(self.Owner) and not self.Owner:IsNPC() then + local vm = self.Owner:GetViewModel() + if IsValid(vm) then + self:ResetBonePositions(vm) + end + end + if timer.Exists("davy_crocket_"..self.Owner:UniqueID()) then timer.Destroy("davy_crocket_"..self.Owner:UniqueID()) end + return true +end + +SWEP.VElements = { + ["bomb"] = { type = "Model", model = "models/Failure/MK6/m62.mdl", bone = "Rocket", rel = "", pos = Vector(-0.093, 7.412, -0.005), angle = Angle(-45, 0, 90), size = Vector(0.449, 0.449, 0.449), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.WElements = { + ["nuke"] = { type = "Model", model = "models/failure/mk6/m62.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(28.054, 0.268, -5.1), angle = Angle(-90, 0, 0), size = Vector(0.504, 0.504, 0.504), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +if GetConVar("DavyCrocketAdminOnly") == nil then + print("DavyCrocketAdminOnly is missing! You may have hit the lua limit!") +else + if GetConVar("DavyCrocketAdminOnly"):GetInt() == 1 then + SWEP.Spawnable = false + end +end + +if GetConVar("M9KDefaultClip") == nil then + print("M9KDefaultClip is missing! You may have hit the lua limit!") +else + if GetConVar("M9KDefaultClip"):GetInt() != -1 then + SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize * GetConVar("M9KDefaultClip"):GetInt() + end +end + +if GetConVar("M9KUniqueSlots") != nil then + if not (GetConVar("M9KUniqueSlots"):GetBool()) then + SWEP.SlotPos = 2 + end +end + +/*--------------------------------------------------------- +IronSight +-----------------------------------------------------*/ +function SWEP:IronSight() + + if not IsValid(self) then return end + if not IsValid(self.Owner) then return end + + if !self.Owner:IsNPC() then + if self.ResetSights and CurTime() >= self.ResetSights then + self.ResetSights = nil + end + end + + if self.CanBeSilenced and self.NextSilence < CurTime() then + if self.Owner:KeyDown(IN_USE) and self.Owner:KeyPressed(IN_ATTACK2) then + self:Silencer() + end + end + + if self.SelectiveFire and self.NextFireSelect < CurTime() and not (self.Weapon:GetNWBool("Reloading")) then + if self.Owner:KeyDown(IN_USE) and self.Owner:KeyPressed(IN_RELOAD) then + self:SelectFireMode() + end + end + +-- //copy this... + if self.Owner:KeyPressed(IN_SPEED) and not (self.Weapon:GetNWBool("Reloading")) then -- If you are running + if self.Weapon:GetNextPrimaryFire() <= (CurTime()+0.3) then + self.Weapon:SetNextPrimaryFire(CurTime()+0.3) -- Make it so you can't shoot for another quarter second + end + self.IronSightsPos = self.RunSightsPos -- Hold it down + self.IronSightsAng = self.RunSightsAng -- Hold it down + self:SetIronsights(true, self.Owner) -- Set the ironsight true + self.Owner:SetFOV( 0, 0.3 ) + self.DrawCrosshair = false + end + + if self.Owner:KeyReleased (IN_SPEED) then -- If you release run then + self:SetIronsights(false, self.Owner) -- Set the ironsight true + self.Owner:SetFOV( 0, 0.3 ) + self.DrawCrosshair = self.OrigCrossHair + end -- Shoulder the gun + +-- //down to this + if !self.Owner:KeyDown(IN_USE) and !self.Owner:KeyDown(IN_SPEED) then + -- //If the key E (Use Key) is not pressed, then + + if self.Owner:KeyPressed(IN_ATTACK2) and not (self.Weapon:GetNWBool("Reloading")) then + self.Owner:SetFOV( self.Secondary.IronFOV, 0.3 ) + self.IronSightsPos = self.SightsPos -- Bring it up + self.IronSightsAng = self.SightsAng -- Bring it up + self:SetIronsights(true, self.Owner) + self.DrawCrosshair = false + -- //Set the ironsight true + + if CLIENT then return end + end + end + + if self.Owner:KeyReleased(IN_ATTACK2) and !self.Owner:KeyDown(IN_USE) and !self.Owner:KeyDown(IN_SPEED) then + -- //If the right click is released, then + self.Owner:SetFOV( 0, 0.3 ) + self.DrawCrosshair = self.OrigCrossHair + self:SetIronsights(false, self.Owner) + -- //Set the ironsight false + + if CLIENT then return end + end + + if self.Owner:KeyDown(IN_ATTACK2) and !self.Owner:KeyDown(IN_USE) and !self.Owner:KeyDown(IN_SPEED) then + self.SwayScale = 0.05 + self.BobScale = 0.05 + else + self.SwayScale = 1.0 + self.BobScale = 1.0 + end +end \ No newline at end of file diff --git a/m9k_specialties_fatal_edition/lua/weapons/m9k_orbital_strike/shared.lua b/m9k_specialties_fatal_edition/lua/weapons/m9k_orbital_strike/shared.lua new file mode 100644 index 0000000..aa9d5e6 --- /dev/null +++ b/m9k_specialties_fatal_edition/lua/weapons/m9k_orbital_strike/shared.lua @@ -0,0 +1,193 @@ +-- Variables that are used on both client and server +SWEP.Gun = ("m9k_orbital_strike") -- must be the name of your swep +if (GetConVar(SWEP.Gun.."_allowed")) != nil then + if not (GetConVar(SWEP.Gun.."_allowed"):GetBool()) then SWEP.Base = "bobs_blacklisted" SWEP.PrintName = SWEP.Gun return end +end +SWEP.Category = "M9K Specialties" +SWEP.Author = "" +SWEP.Contact = "" +SWEP.Purpose = "" +SWEP.Instructions = "" +SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models +SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models +SWEP.PrintName = "Orbital Strike Marker" -- Weapon name (Shown on HUD) +SWEP.Slot = 4 -- Slot in the weapon selection menu +SWEP.SlotPos = 35 -- Position in the slot +SWEP.DrawAmmo = true -- Should draw the default HL2 ammo counter +SWEP.DrawWeaponInfoBox = false -- Should draw the weapon info box +SWEP.BounceWeaponIcon = false -- Should the weapon icon bounce? +SWEP.DrawCrosshair = false -- Set false if you want no crosshair from hip +SWEP.Weight = 50 -- Rank relative ot other weapons. bigger is better +SWEP.AutoSwitchTo = true -- Auto switch to if we pick it up +SWEP.AutoSwitchFrom = true -- Auto switch from if you pick up a better weapon +SWEP.XHair = false -- Used for returning crosshair after scope. Must be the same as DrawCrosshair +SWEP.HoldType = "camera" + +SWEP.ViewModelFOV = 70 +SWEP.ViewModelFlip = false +SWEP.ViewModel = "models/weapons/v_invisib.mdl" -- Weapon view model +SWEP.WorldModel = "models/weapons/w_binos.mdl" -- Weapon world model +SWEP.Base = "bobs_scoped_base" +SWEP.Spawnable = true +SWEP.AdminSpawnable = true + +SWEP.Primary.Sound = Sound("weapons/satellite/targaquired.mp3") -- script that calls the primary fire sound +SWEP.Primary.RPM = 50 -- This is in Rounds Per Minute +SWEP.Primary.ClipSize = 1 -- Size of a clip +SWEP.Primary.DefaultClip = 1 -- Bullets you start with +SWEP.Primary.KickUp = 1 -- Maximum up recoil (rise) +SWEP.Primary.KickDown = 1 -- Maximum down recoil (skeet) +SWEP.Primary.KickHorizontal = 1 -- Maximum up recoil (stock) +SWEP.Primary.Automatic = false -- Automatic/Semi Auto +SWEP.Primary.Ammo = "SatCannon" + +SWEP.Secondary.ScopeZoom = 5 +SWEP.Secondary.UseParabolic = false -- Choose your scope type, +SWEP.Secondary.UseACOG = false +SWEP.Secondary.UseMilDot = true +SWEP.Secondary.UseSVD = false +SWEP.Secondary.UseElcan = false +SWEP.Secondary.UseGreenDuplex = false + +SWEP.data = {} --The starting firemode +SWEP.data.ironsights = 1 +SWEP.ScopeScale = 1 + +-- enter iron sight info and bone mod info below + +SWEP.IronSightsPos = Vector(-3.589, -8.867, -4.124) +SWEP.IronSightsAng = Vector(50.353, 17.884, -19.428) +SWEP.SightsPos = Vector(-3.589, -8.867, -4.124) +SWEP.SightsAng = Vector(50.353, 17.884, -19.428) +SWEP.RunSightsPos = Vector(0, 0, 0) +SWEP.RunSightsAng = Vector(-21.994, 0, 0) + +SWEP.ViewModelBoneMods = { + ["l-ring-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-19.507, 0, 0) }, + ["r-index-mid"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-71.792, 0, 0) }, + ["r-middle-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-21.483, 1.309, 0) }, + ["l-upperarm-movement"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, -0.88), angle = Angle(0, 0, 0) }, + ["Da Machete"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0.263, -1.826), angle = Angle(0, 0, 0) }, + ["r-ring-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-17.507, 0, 0) }, + ["r-pinky-mid"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-47.32, 0, 0) }, + ["r-ring-mid"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-54.065, 0, 0) }, + ["r-index-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-49.646, 0, 0) }, + ["r-thumb-tip"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-17.666, 0, 0) }, + ["r-upperarm-movement"] = { scale = Vector(1, 1, 1), pos = Vector(7.394, 2.101, -9.54), angle = Angle(-10.502, -12.632, 68.194) }, + ["r-pinky-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-21.526, 0, 0) }, + ["r-middle-mid"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-37.065, 0, 0) }, + ["r-thumb-mid"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-4.816, 18.775, -30.143) }, + ["l-index-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-49.646, 0, 0) }, + ["r-thumb-low"] = { scale = Vector(1, 1, 1), pos = Vector(0, 0, 0), angle = Angle(-0.982, 0, 0) } +} + +SWEP.VElements = { + ["binos"] = { type = "Model", model = "models/weapons/binos.mdl", bone = "r-thumb-low", rel = "", pos = Vector(3.907, -0.109, -1.125), angle = Angle(-2.829, 27.281, 105.791), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } +} + +SWEP.PoorBastard = false +SWEP.NextShoot = 0 + +function SWEP:PrimaryAttack() + self.PoorBastard = false + if not IsFirstTimePredicted() then return end + if self:CanPrimaryAttack() and self.Owner:IsPlayer() and self.NextShoot <= CurTime() then + if !self.Owner:KeyDown(IN_SPEED) and !self.Owner:KeyDown(IN_RELOAD) then + local mark = self.Owner:GetEyeTrace() + if mark.HitSky then + self.Owner:EmitSound("player/suit_denydevice.wav") + end + + local skytrace = {} + skytrace.start = mark.HitPos + skytrace.endpos = mark.HitPos + Vector(0,0,65000) + skycheck = util.TraceLine(skytrace) + if skycheck.HitSky then + if SERVER then + local Sky = skycheck.HitPos - Vector(0,0,10) + local Ground = mark.HitPos + Satellite = ents.Create("m9k_oribital_cannon") + Satellite.Ground = Ground + Satellite.Sky = Sky + Satellite.Owner = self.Owner + Satellite:SetPos(Sky) //was sky but for testing, its this + Satellite:Spawn() + end + if SERVER then self.Owner:EmitSound(self.Primary.Sound) end + self.Weapon:TakePrimaryAmmo(1) + self.Weapon:SetNextPrimaryFire(CurTime()+15) + self.NextShoot = CurTime() + 15 + self:CheckWeaponsAndAmmo() + self:Reload() + elseif mark.Entity:IsPlayer() or mark.Entity:IsNPC() then + self.PoorBastard = true + thetarget = mark.Entity + skytrace2 = {} + skytrace2.start = thetarget:GetPos() + skytrace2.endpos = thetarget:GetPos() + Vector(0,0,65000) + skytrace2.filter = thetarget + skycheck2 = util.TraceLine(skytrace2) + if skycheck2.HitSky then //someone's gonna be in big trouble + sky2 = skycheck2.HitPos - Vector(0,0,10) + if SERVER then + Satellite = ents.Create("m9k_oribital_cannon") + --Satellite.Ground = Ground + Satellite.PoorBastard = true + Satellite.Target = thetarget + Satellite.Sky = sky2 + Satellite.Owner = self.Owner + Satellite:SetPos(sky2) + Satellite:Spawn() + end + self.Owner:EmitSound(self.Primary.Sound) + self.Weapon:TakePrimaryAmmo(1) + self.Weapon:SetNextPrimaryFire(CurTime()+15) + self.NextShoot = CurTime() + 15 + self:CheckWeaponsAndAmmo() + self:Reload() + else + self.Owner:EmitSound("player/suit_denydevice.wav") + end + else + self.Owner:EmitSound("player/suit_denydevice.wav") + end + end + end +end + +function SWEP:CheckWeaponsAndAmmo() + if SERVER and self.Weapon != nil then + if self.Weapon:Clip1() == 0 && self.Owner:GetAmmoCount( self.Weapon:GetPrimaryAmmoType() ) == 0 and (GetConVar("M9KWeaponStrip"):GetBool()) then + timer.Simple(.1, function() if SERVER then if not IsValid(self) then return end + if not IsValid(self.Owner) then return end + self.Owner:StripWeapon(self.Gun) + end end) + else + self:Reload() + end + end +end + + + +if GetConVar("OrbitalStrikeAdminOnly") == nil then + print("OrbitalStrikeAdminOnly is missing! You may have hit the lua limit!") +else + if GetConVar("OrbitalStrikeAdminOnly"):GetInt() == 1 then + SWEP.Spawnable = false + end +end + +if GetConVar("M9KDefaultClip") == nil then + print("M9KDefaultClip is missing! You may have hit the lua limit!") +else + if GetConVar("M9KDefaultClip"):GetInt() != -1 then + SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize * GetConVar("M9KDefaultClip"):GetInt() + end +end + +if GetConVar("M9KUniqueSlots") != nil then + if not (GetConVar("M9KUniqueSlots"):GetBool()) then + SWEP.SlotPos = 2 + end +end \ No newline at end of file