[ERROR] addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:70: '=' expected near 'function'
1. unknown - addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:0
Thats appear on my console.
I checked all of code and nothing, so help me
CODE
if ( SERVER ) then
resource.AddFile( "materials/entities/vgui/oicw_beta" )
end
//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.Sound = "sound/oicw/ar2_fire1.wav" // The sound that plays when you shoot your SWEP :-]
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.Scoped.TakeAmmo = 2 // Ammo taked per shot in scoped mode
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.Scoped.NumberofShots = 2 // The same but define Scope Mode
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!
SWEP.Secondary.ClipSize
//Secondary Fire Variables\\
//SWEP:Initialize\\
function SWEP:Initialize() //Tells the script what to do when the player "Initializes" the SWEP.
util.PrecacheSound(Sound(self.Primary.Sound))
util.PrecacheSound(Sound(self.Primary.Sound))
self:SetWeaponHoldType( self.HoldType )
end
//SWEP:Initialize\\
//SWEP:Purpose\\
//SWEP:Purpose\\
//SWEP:Think\\
//SWEP:Think\\
//SWEP:PrimaryFire\\
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:SetOrigin(tr.HitPos);
effect:SetNormal( tr.HitNormal );
util.Effect("MetalSpark", effect);
dmginfo:SetDamageType(DMG_AIRBOAT);
end;
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self:ShootEffects()
self.Owner:FireBullets( bullet )
self:EmitSound(Sound(self.Primary.Sound))
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
self.Owner:MuzzleFlash();
self.Owner:SetAnimation( PLAYER_ATTACK1 );
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK );
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end
//SWEP:PrimaryFire\\
//SWEP:FireAnimationEvent\\
//SWEP:FireAnimationEvent\\
//SWEP:SecondaryFire\\
function SWEP:SecondaryAttack()
self.Weapon:EmitSound( self.Secondary.Sound );
vecThrow = vecThrow * 90000.0;
if ( !CLIENT ) then
//Create the grenade
local pGrenade = ents.Create( self.Secondary.AmmoType );
pGrenade:SetPos( pPlayer:GetAimVector );
pGrenade:SetOwner( pPlayer );
pGrenade:Spawn()
pGrenade:GetPhysicsObject():SetVelocity( vecThrow );
pGrenade:GetPhysicsObject():SetAngleVelocity( RandomAngle( -400, 400 ) );
pGrenade:SetOwner( self.Owner );
end
self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK );
// player "shoot" animation
pPlayer:SetAnimation( PLAYER_ATTACK1 );
end
//SWEP:SecondaryFire\\
First off: use [code] tags
[lua]SWEP.Secondary.ClipSize[/lua]
Line 66, you just left the name there. Either define the variable or remove the line.
[QUOTE=JakusPL;46200550][ERROR] addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:70: '=' expected near 'function'
1. unknown - addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:0
Thats appear on my console.
I checked all of code and nothing, so help me
CODE
[lua]
if ( SERVER ) then
resource.AddFile( "materials/entities/vgui/oicw_beta" )
end
//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.Sound = "sound/oicw/ar2_fire1.wav" // The sound that plays when you shoot your SWEP :-]
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.Scoped.TakeAmmo = 2 // Ammo taked per shot in scoped mode
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.Scoped.NumberofShots = 2 // The same but define Scope Mode
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!
SWEP.Secondary.ClipSize
//Secondary Fire Variables\\
//SWEP:Initialize\\
function SWEP:Initialize() //Tells the script what to do when the player "Initializes" the SWEP.
util.PrecacheSound(Sound(self.Primary.Sound))
util.PrecacheSound(Sound(self.Primary.Sound))
self:SetWeaponHoldType( self.HoldType )
end
//SWEP:Initialize\\
//SWEP:Purpose\\
//SWEP:Purpose\\
//SWEP:Think\\
//SWEP:Think\\
//SWEP:PrimaryFire\\
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:SetOrigin(tr.HitPos);
effect:SetNormal( tr.HitNormal );
util.Effect("MetalSpark", effect);
dmginfo:SetDamageType(DMG_AIRBOAT);
end;
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self:ShootEffects()
self.Owner:FireBullets( bullet )
self:EmitSound(Sound(self.Primary.Sound))
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
self.Owner:MuzzleFlash();
self.Owner:SetAnimation( PLAYER_ATTACK1 );
self:SendWeaponAnim( ACT_VM_PRIMARYATTACK );
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end
//SWEP:PrimaryFire\\
//SWEP:FireAnimationEvent\\
//SWEP:FireAnimationEvent\\
//SWEP:SecondaryFire\\
function SWEP:SecondaryAttack()
self.Weapon:EmitSound( self.Secondary.Sound );
vecThrow = vecThrow * 90000.0;
if ( !CLIENT ) then
//Create the grenade
local pGrenade = ents.Create( self.Secondary.AmmoType );
pGrenade:SetPos( pPlayer:GetAimVector );
pGrenade:SetOwner( pPlayer );
pGrenade:Spawn()
pGrenade:GetPhysicsObject():SetVelocity( vecThrow );
pGrenade:GetPhysicsObject():SetAngleVelocity( RandomAngle( -400, 400 ) );
pGrenade:SetOwner( self.Owner );
end
self.Weapon:SendWeaponAnim( ACT_VM_SECONDARYATTACK );
// player "shoot" animation
pPlayer:SetAnimation( PLAYER_ATTACK1 );
end
//SWEP:SecondaryFire\\[/lua][/QUOTE]
[lua]
//Secondary Fire Variables\\
SWEP.Secondary.Ammo = "grenade_ar2" // Leave as Pistol!
SWEP.Secondary.ClipSize
//Secondary Fire Variables\\[/lua]
you need to assign clipsize to something or remove that line
Thanks but now we have this:
[ERROR] addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:142: function arguments expected near ')'
1. unknown - addons/oicw-hl2_beta/lua/weapons/oicw_beta/shared.lua:0
[editline]10th October 2014[/editline]
oh now all is good but sounds dont work. In conosle: missing file from disk, cant load (something like that XD) PLEASE HELP
Did you [url]http://wiki.garrysmod.com/page/resource/AddFile[/url] the soundfile?
THANKS
Sorry, you need to Log In to post a reply to this thread.