HELP! ')' expected near ';'

This is my error:
[ERROR] addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:142: ‘)’ expected near ‘;’

  1. unknown - addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:0

I checked everything and nothing. HELP PLEASE!

if ( SERVER ) then

resource.AddFile( "materials/entities/vgui/oicw_beta" )


//General Settings \
SWEP.PrintName = “OICW” // The name of your SWEP

SWEP.Author = “Jakus PL”
SWEP.Instructions = “Press Mouse3 to fire a grenade, Mouse2 to scope!!!” // How do people use your SWEP?
SWEP.Contact = “Comments” // How people should contact you if they find bugs, errors, etc
SWEP.Purpose = “Nope” // What is the purpose of the SWEP?

SWEP.AdminSpawnable = true // Is the SWEP spawnable for admins?
SWEP.Spawnable = true // Can everybody spawn this SWEP? - If you want only admins to spawn it, keep this false and admin spawnable true.

SWEP.ViewModelFOV = 68 // How much of the weapon do you see?
SWEP.ViewModel = “models/weapons/v_oicw.mdl”

SWEP.WorldModel = “models/weapons/w_oicw.mdl”
SWEP.UseHands = false

SWEP.AutoSwitchTo = true // When someone picks up the SWEP, should it automatically change to your SWEP?
SWEP.AutoSwitchFrom = false // Should the weapon change to the a different SWEP if another SWEP is picked up?

SWEP.Slot = 3 // Which weapon slot you want your SWEP to be in? (1 2 3 4 5 6)
SWEP.SlotPos = 1 // Which part of that slot do you want the SWEP to be in? (1 2 3 4 5 6)

SWEP.HoldType = “ar2” // How is the SWEP held? (Pistol SMG Grenade Melee)

SWEP.FiresUnderwater = false // Does your SWEP fire under water?

SWEP.Weight = 5 // Set the weight of your SWEP.

SWEP.DrawCrosshair = true // Do you want the SWEP to have a crosshair?

SWEP.Category = “JakusPL - HL2 Beta SWeps” // Which weapon spawning category do you want your SWEP to be in?

SWEP.DrawAmmo = false // Does the ammo show up when you are using it? True / False

SWEP.ReloadSound = “sound/oicw/ar2_reload.wav” // Reload sound, you can use the default ones, or you can use your own; Example; “sound/myswepreload.wav”

SWEP.base = “weapon_base” //What your weapon is based on.
//General settings\

//PrimaryFire Settings\
SWEP.Primary.Damage = 7 // How much damage the SWEP will do.
SWEP.Primary.TakeAmmo = 1 // How much ammo does the SWEP use each time you shoot?
SWEP.Primary.ClipSize = 30 // The clip size.
SWEP.Primary.Ammo = “smg1” // The ammo used by the SWEP. (pistol/smg1)
SWEP.Primary.DefaultClip = 90 // How much ammo do you get when you first pick up the SWEP?
SWEP.Primary.Spread = 0.3 // Do the bullets spread all over when firing? If you want it to shoot exactly where you are aiming, leave it at 0.1
SWEP.Primary.NumberofShots = 1 // How many bullets the SWEP fires each time you shoot.
SWEP.Primary.Automatic = true // Is the SWEP automatic?
SWEP.Primary.Recoil = 0.4 // How much recoil does the weapon have?
SWEP.Primary.Delay = 0.08 // How long must you wait before you can fire again?
SWEP.Primary.Force = 5 // The force of the shot.
//PrimaryFire settings\

//Secondary Fire Variables\
SWEP.Secondary.Ammo = “grenade_ar2” // Leave as Pistol!
//Secondary Fire Variables\

function SWEP:Initialize() //Tells the script what to do when the player “Initializes” the SWEP.
self:SetWeaponHoldType( self.HoldType )




function SWEP:PrimaryAttack()

if ( !self:CanPrimaryAttack() ) then return end

local bullet = {}
	bullet.Num = self.Primary.NumberofShots //The number of shots fired
	bullet.Src = self.Owner:GetShootPos() //Gets where the bullet comes from
	bullet.Dir = self.Owner:GetAimVector() //Gets where you're aiming
	bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
            //The above, sets how far the bullets spread from each other.
	bullet.Tracer = 1
	bullet.Force = self.Primary.Force
	bullet.Damage = self.Primary.Damage
	bullet.AmmoType = self.Primary.Ammo
	bullet.TracerName = "Tracer"
	bullet.Callback = function ( attacker, tr, dmginfo )
					local effect = EffectData();
					effect:SetNormal( tr.HitNormal );
					util.Effect("MetalSpark", effect);

local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)


self.Owner:FireBullets( bullet )

self.Owner:SetAnimation( PLAYER_ATTACK1 );
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK );

self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:SetNextSecondaryFire( CurTime() + self.Primary.Delay )



function SWEP:SecondaryAttack()


local	vecThrow;
vecThrow = self:GetAimVector();
vecThrow = vecThrow * 1000.0;

if ( !CLIENT ) then
//Create the grenade
local pGrenade = ents.Create( self.Secondary.AmmoType );
pGrenade:SetPos( self.Owner:GetShootPos();
pGrenade:SetOwner( self );

pGrenade:GetPhysicsObject():SetVelocity( vecThrow );
pGrenade:GetPhysicsObject():SetAngleVelocity( RandomAngle( -400, 400 ) );
pGrenade:SetOwner( self.Owner );


self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK );

// player "shoot" animation
pPlayer:SetAnimation( PLAYER_ATTACK1 );


the answer is in the error.

first: Line 142
[lua]pGrenade:SetPos( self.Owner:GetShootPos();[/lua]
So then we gonna look at the error.
‘)’ expected near ‘;’
So it expected an )
So we took another look at it.

There should be an ) that the engine excepted.

Try to understand the Error Logs. You got an simmilar problem a few days ago.

thanks, i still learning lua, you know. Some errors are easy to fix but other is not

[editline]11th October 2014[/editline]

oh its not working, still in line 142

[editline]11th October 2014[/editline]

oh i fixed it. This is the answer: pGrenade:SetPos( self.Owner:GetShootPos());

[editline]11th October 2014[/editline]

oh i fixed it. This is the answer: pGrenade:SetPos( self.Owner:GetShootPos());

[editline]11th October 2014[/editline]

But i always get: “Missing sound from disk/repository”. As you can see I precached this sound and added it with “resource.AddFile” and nothing.

When you use resource.AddFile ( I’d recommend resource.AddSingleFile because AddFile “adds” associated files, while AddSingle just adds the file you want… ) make sure you use: resource.AddSingleFile( “sound/path/to/sound.wav” );

But, when you play it, it is just sound.Play( “path/to/sound.wav” );

Example in the form of a TTT End-Round-Music addon with sound files in the correct location ( Look at how it plays vs how it is resource.AddFile’d ):

If you want a simple automatic resource loader system: [ Download into garrysmod/addons/acecool/lua/autorun/server/sv_add_gamemode_resources.lua ] ( HTML View with syntax highlighting: )

That will add all files that are in your garrysmod/gamemoes/<current_gamemode>/content/ folder.

If you want it to work with FastDL, here’s how to set up FastDL ( note: It is possible to have FastDL download files into the incorrect folder if the paths aren’t right ):

thunks XD