As Soon As I shoot a gun i downloaded off garrysmod.org
it comes with this error
[ERROR] lua/effects/gdcw_impact/init.lua:14: attempt to call global 'WorldSound' (a nil value)
1. unknown - lua/effects/gdcw_impact/init.lua:14
I'm making A gun as well At the moment, which im having problems with the 'missing texture' scope (intervention)
If anyone could help me that would be great
[CODE]// Variables that are used on both client and server
SWEP.Category = "BBB Community Weapons"
SWEP.Author = "Sir. Abyssal2001 / Sir. Braden1996"
SWEP.Contact = "Contact Me Over Steam (AbbysalJ)"
SWEP.Purpose = "Replacement On the BBB Server"
SWEP.Instructions = "Aim Away From Brendan/Jake"
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.DrawCrosshair = false
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/weapons/v_interventionhbs.mdl"
SWEP.WorldModel = "models/weapons/w_interventionhbs.mdl"
SWEP.Base = "gdcw_base_rifleman"
SWEP.EquipMenuData = {
type = "Weapon",
desc = "The BBB Replacement Of the AWP! By Sir. Abyssal2001"
};
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.Sound = Sound("weapons/interventionhbs/fire.wav")
SWEP.Primary.Round = ("gdcwa_.408cheytac_fmj")
SWEP.Primary.RPM = 50 // This is in Rounds Per Minute
SWEP.Primary.ClipSize = 5 // Size of a clip
SWEP.Primary.DefaultClip = 6 // Default number of bullets in a clip
SWEP.Primary.KickUp = 4.2 // Maximum up recoil (rise)
SWEP.Primary.KickDown = .2 // Maximum down recoil (skeet)
SWEP.Primary.KickHorizontal = 2.4 // Maximum up recoil (stock)
SWEP.Primary.Automatic = false // Automatic/Semi Auto
SWEP.Primary.Ammo = "XBowBolt"
SWEP.data = {} -- The starting firemode
SWEP.data.ironsights = 1
SWEP.ScopeScale = 0.8
SWEP.SightsPos = Vector (2.6033, -2.8662, 0.4228)
SWEP.SightsAng = Vector (-0.3699, -1.4971, 0.4952)
SWEP.RunSightsPos = Vector (-2.3095, -3.0514, 1.3965)
SWEP.RunSightsAng = Vector (-19.8471, -33.9181, 10)
SWEP.Kind = WEAPON_EQUIP1
SWEP.AutoSpawnable = false
SWEP.InLoadoutFor = nil
SWEP.LimitedStock = true
SWEP.IsSilent = false
SWEP.NoSights = false
SWEP.CanBuy = { ROLE_TRAITOR }
function SWEP:SecondaryAttack()
if not self.IronSightsPos then return end
if self.Weapon:GetNextSecondaryFire() > CurTime() then return end
bIronsights = not self:GetIronsights()
self:SetIronsights( bIronsights )
if SERVER then
self:SetZoom(bIronsights)
else
self:EmitSound(self.Secondary.Sound)
end
self.Weapon:SetNextSecondaryFire( CurTime() + 0.3)
end
function SWEP:PreDrop()
self:SetZoom(false)
self:SetIronsights(false)
return self.BaseClass.PreDrop(self)
end
function SWEP:Holster()
self:SetIronsights(false)
self:SetZoom(false)
return true
end
function SWEP:SetZoom(state)
if CLIENT then
return
else
if state then
self.Owner:SetFOV(20, 0.3)
else
self.Owner:SetFOV(0, 0.2)
end
end
end
function SWEP:Reload()
return false
end
if CLIENT then
local scope = surface.GetTextureID("sprites/scope")
function SWEP:DrawHUD()
if self:GetIronsights() then
surface.SetDrawColor( 0, 0, 0, 255 )
local x = ScrW() / 2.0
local y = ScrH() / 2.0
local scope_size = ScrH()
-- crosshair
local gap = 80
local length = scope_size
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
gap = 0
length = 50
surface.DrawLine( x - length, y, x - gap, y )
surface.DrawLine( x + length, y, x + gap, y )
surface.DrawLine( x, y - length, x, y - gap )
surface.DrawLine( x, y + length, x, y + gap )
-- cover edges
local sh = scope_size / 2
local w = (x - sh) + 2
surface.DrawRect(0, 0, w, scope_size)
surface.DrawRect(x + sh - 2, 0, w, scope_size)
surface.SetDrawColor(255, 0, 0, 255)
surface.DrawLine(x, y, x + 1, y + 1)
-- scope
surface.SetTexture(scope)
surface.SetDrawColor(255, 255, 255, 255)
surface.DrawTexturedRectRotated(x, y, scope_size, scope_size, 0)
else
return self.BaseClass.DrawHUD(self)
end
end
function SWEP:AdjustMouseSensitivity()
return (self:GetIronsights() and 0.2) or nil
end
end[/CODE]
BTW Guys i'm still a noob at developing
Is there any way that i can change this? or is it A gun needed to be completely rewrote
Just change the function from WorldSound to sound.Play.
thanks for teh quick reply :)
EDIT: i'm still a noob at this ^_^
Sorry to annoy you. What is the path for it?
[QUOTE=Sir Abyssal;42891500]thanks for teh quick reply :)
EDIT: i'm still a noob at this ^_^
Sorry to annoy you. What is the path for it?[/QUOTE]
Path for what? How can you have difficulties replacing one word with another in the code you posted?
[QUOTE=Robotboy655;42891566]Path for what? How can you have difficulties replacing one word with another in the code you posted?[/QUOTE]
Since i know nothing, which line am i editing is what i mean
[QUOTE]the line that says WorldSound?[/QUOTE]
yup im spoonfed, but ive used the find function and in no part of this code is it showing 'worldsound'
The error is telling you which file it is in - as well as what line.
[quote][ERROR] lua/effects/gdcw_impact/init.lua:14: attempt to call global 'WorldSound' (a nil value)[/quote]
[QUOTE=Sir Abyssal;42891768]yup im spoonfed, but ive used the find function and in no part of this code is it showing 'worldsound'[/QUOTE]
lua/effects/gdcw_impact/init.lua line 14
[QUOTE=Kogitsune;42891777]The error is telling you which file it is in - as well as what line.[/QUOTE]
Ohhhh - Thank you for that !
Sorry, you need to Log In to post a reply to this thread.