I'm quite new to lua scripting so I have no idea if I'm doing something wrong. But here is the code :
[CODE]//this part is for making kill icons
local icol = Color( 255, 255, 255, 255 )
if CLIENT then
killicon.Add( "test_rifle", "vgui/hud/test_rifle", icol )
-- weapon name location of weapon's kill icon, I just used the hud icon
end
//these are some variables we need to keep for stuff to work
//that means don't delete them
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("M9KUniqueSlots") == nil then
CreateConVar("M9KUniqueSlots", "0", { 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("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("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("DebugM9K") == nil then
CreateConVar("DebugM9K", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE }, "Debugging for some m9k stuff, turning it on won't change much.")
end
if !game.SinglePlayer() then
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
//I always leave a note reminding me which weapon these sounds are for
//weapon name
sound.Add({
name = "sg550_gunshot",
channel = CHAN_USER_BASE+10, --see how this is a different channel? Gunshots go here
volume = 1.0,
sound = {"weapons/gunshot_bride/sg550-1.wav",
"weapons/gunshot_bride/sg550-2.wav"}
})
sound.Add({
name = "Weapon_Improv_SG550.Clipout",
channel = CHAN_ITEM,
volume = 1.0,
sound = "weapons/gunshot_bride/sg550_clipout.wav"
})
sound.Add({
name = "Weapon_Improv_SG550.Clipin",
channel = CHAN_ITEM,
volume = 1.0,
sound = "weapons/gunshot_bride/sg550_clipin.wav"
})
sound.Add({
name = "Weapon_Improv_SG550.BoltPull",
channel = CHAN_ITEM,
volume = 1.0,
sound = "weapons/gunshot_bride/sg550_boltpull.wav"
})[/CODE]
EDIT : Script error has now been fixed. It's just that it crashes when I give myself the wep. For those who want to see the shared.lua file.
[CODE]-- Variables that are used on both client and server
SWEP.Gun = ("sig_sg_550") -- must be the name of your swep but NO CAPITALS!
SWEP.Category = "SIG SG 550" --Category where you will find your weapons
SWEP.Author = "Mr. Pyrous"
SWEP.Contact = ""
SWEP.Purpose = "Isn't it obvious?"
SWEP.Instructions = "You know what to do, don't you? :3"
SWEP.PrintName = "SIG SG 550" -- Weapon name (Shown on HUD)
SWEP.Slot = 2 -- Slot in the weapon selection menu
SWEP.SlotPos = 3 -- 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 = true -- Set false if you want no crosshair from hip
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.XHair = true -- Used for returning crosshair after scope. Must be the same as DrawCrosshair
SWEP.BoltAction = false -- Is this a bolt action rifle?
SWEP.HoldType = "ar2" -- 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 crossbow make for good sniper rifles
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/weapons/v_improv_snip_sg550.mdl" -- Weapon view model
SWEP.WorldModel = "models/weapons/w_irifle.mdl" -- Weapon world model
SWEP.ShowWorldModel = false
SWEP.Base = "improv_cs_scoped_base" --the Base this weapon will work on. PLEASE RENAME THE BASE!
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.Sound = Sound("sg550_gunshot") -- script that calls the primary fire sound
SWEP.Primary.RPM = 625 -- This is in Rounds Per Minute
SWEP.Primary.ClipSize = 30 -- Size of a clip
SWEP.Primary.DefaultClip = 60 -- Bullets you start with
SWEP.Primary.KickUp = 0.4 -- Maximum up recoil (rise)
SWEP.Primary.KickDown = 0.3 -- Maximum down recoil (skeet)
SWEP.Primary.KickHorizontal = 0.3 -- Maximum up recoil (stock)
SWEP.Primary.Automatic = true -- Automatic/Semi Auto
SWEP.Primary.Ammo = "ar2" -- pistol, 357, smg1, ar2, buckshot, slam, SniperPenetratedRound, AirboatGun
-- Pistol, buckshot, and slam always ricochet. Use AirboatGun for a light metal peircing shotgun pellets
SWEP.Secondary.ScopeZoom = 3
SWEP.Secondary.UseACOG = true -- Choose one scope type
SWEP.Secondary.UseMilDot = false -- I mean it, only one
SWEP.Secondary.UseSVD = false -- If you choose more than one, your scope will not show up at all
SWEP.Secondary.UseParabolic = false
SWEP.Secondary.UseElcan = false
SWEP.Secondary.UseGreenDuplex = false
SWEP.data = {}
SWEP.data.ironsights = 1
SWEP.ScopeScale = 0.5
SWEP.ReticleScale = 0.6
SWEP.Primary.Damage = 30 --base damage per bullet
SWEP.Primary.Spread = .015 --define from-the-hip accuracy 1 is terrible, .0001 is exact)
SWEP.Primary.IronAccuracy = .01 -- ironsight accuracy, should be the same for shotguns
-- enter iron sight info and bone mod info below
SWEP.IronSightsPos = Vector (0, 0, 0)
SWEP.IronSightsAng = Vector (0, 0, 0)
SWEP.RunSightsPos = Vector (0, 0, 0)
SWEP.RunSightsAng = Vector (0, 0, 0)[/CODE]
Please help as soon as possible. Thanks.
Post the line 69.
[QUOTE=Robotboy655;43667068]Post the line 69.[/QUOTE]
Lines 69 and 70
[CODE]sound = ("weapons/gunshot_bride/sg550-1.wav",
"weapons/gunshot_bride/sg550-2.wav")[/CODE]
If you are trying to make a table, use { and } not ( and )
[QUOTE=MeepDarknessM;43667129]If you are trying to make a table, use { and } not ( and )[/QUOTE]
Tried that and instead crashes the game when I give myself the weapon. But it does fix the script error thing tho.
[QUOTE=Robotboy655;43667249][code]
sound.Add( {
name = "sg550_gunshot",
channel = CHAN_WEAPON,
volume = 1.0,
sound = {
"weapons/gunshot_bride/sg550-1.wav",
"weapons/gunshot_bride/sg550-2.wav"
}
} )[/code]
Should work.[/QUOTE]
It doesn't say any script errors but still crashes when I give myself the weapon. I guess it's the models? If you like, I could give you the files that I'm working with.
Try not using a custom base. Try using different models.
Sorry, you need to Log In to post a reply to this thread.