My friend and I are starting a server, so I decided to learn how to make sweps. I downloaded a format and began editing. I got the damage and models to work right, but the sounds don't work. Here's my code...
[CODE]SWEP.Author = "Zatch McMayge"
SWEP.Contact = "doubleslashstudios@gmail.com"
SWEP.Instructions = "Left-click to throw a single fireball."
SWEP.Purpose = "Throws fireballs using magic."
//The category that you SWep will be shown in, in the Spawn (Q) Menu
//(This can be anything, GMod will create the categories for you)
SWEP.Category = "Magics"
SWEP.Spawnable = false -- Whether regular players can see it
SWEP.AdminSpawnable = true -- Whether Admins/Super Admins can see it
SWEP.ViewModel = "models/weapons/v_fists_t.mdl" -- This is the model used for clients to see in first person.
SWEP.WorldModel = "models/weapons/w_vists_t.mdl" -- This is the model shown to all other clients and in third-person.
//This determines how big each clip/magazine for the gun is. You can
//set it to -1 to disable the ammo system, meaning primary ammo will
//not be displayed and will not be affected.
SWEP.Primary.ClipSize = 100
//This sets the number of rounds in the clip when you first get the gun. Again it can be set to -1.
SWEP.Primary.DefaultClip = 100
//Obvious. Determines whether the primary fire is automatic. This should be true/false
SWEP.Primary.Automatic = false
//Sets the ammunition type the gun uses, see below for a list of types.
//list: ar2,alyxgun,pistol,smg1,357,xbowbolt,buckshot,rpg_round,smg1_grenade,sniperround,sniperpenetratedround
//grenade,thumper,gravity,battery,gaussenergy,combinecannon,airboatgun,striderminigun,helicoptergun,artaltfire,slam
SWEP.Primary.Ammo = "rpg_round"
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.FiresUnderwater = false
SWEP.Primary.Recoil = 1.5
SWEP.Primary.Delay = 0.8
SWEP.Primary.Force = 20
SWEP.Primary.Spread = 0.1
SWEP.Primary.TakeAmmo = 10
SWEP.HoldType = "Melee"
SWEP.Primary.Damage = 40
SWEP.ReloadSound = "sound/fireload.wav"
SWEP.Primary.Sound = "sound/fireball.wav"
if SERVER then // This is where the init.lua stuff goes.
//This makes sure clients download the file
AddCSLuaFile ("shared.lua")
//How heavy the SWep is
SWEP.Weight = 3
//Allow automatic switching to/from this weapon when weapons are picked up
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
elseif CLIENT then // This is where the cl_init.lua stuff goes
//The name of the SWep, as appears in the weapons tab in the spawn menu(Q Menu)
SWEP.PrintName = "Fire Magic"
//Sets the position of the weapon in the switching menu
//(appears when you use the scroll wheel or keys 1-6 by default)
SWEP.Slot = 4
SWEP.SlotPos = 1
//Sets drawing the ammuntion levels for this weapon
SWEP.DrawAmmo = true
//Sets the drawing of the crosshair when this weapon is deployed
SWEP.DrawCrosshair = true
//Ensures a clean looking notification when a chair is undone. How it works:
//When you create an undo, you specify the ID:
// undo.Create("Some_Identity")
//By creating an associated language, we can make the undo notification look better:
// language.Add("Undone_Some_Identity", "Some message...")
language.Add("Undone_Thrown_SWEP_Entity","Undone Thrown SWEP Entity")
end
[/CODE]
Thanks!
Don't use 'sound/' in your sound path.
Sorry, you need to Log In to post a reply to this thread.