Anmelden

Archiv verlassen und diese Seite im Standarddesign anzeigen : Lua Fehler



frog
07.10.2009, 13:35
Kann mir einer Helfen und mir sagen wo hier der Fehler ist und wie ich ihn behebe(Mein erster Lua Versuch ;()

//General Variables\\
SWEP.AdminSpawnable = true
SWEP.ViewModelFOV = 64
SWEP.ViewModel = "models/weapons/v_crowbar.mdl"
SWEP.WorldModel = "models/weapons/v_crowbar.mdl"
SWEP.AutoSwitchTo = false
SWEP.Slot = 1
SWEP.HoldType = "Pistol"
SWEP.PrintName = "ShieldDistruction"
SWEP.Author = "Frog"
SWEP.Spawnable = true
SWEP.AutoSwitchFrom = false
SWEP.FiresUnderwater = true
SWEP.Weight = 5
SWEP.DrawCrosshair = true
SWEP.Category = "Stargate"
SWEP.SlotPos = 0
SWEP.DrawAmmo = false
SWEP.ReloadSound = "Weapon_Pistol.Reload"
SWEP.Instructions = "Shot at a Shield and Blow them Away | With Secondary the Damage go up!"
SWEP.Contact = "[email protected]"
SWEP.Purpose = "testing what this is xD"
SWEP.base = "weapon_base"
//General Variables\\

//Primary Fire Variables\\
SWEP.Primary.Sound = "Weapon_SniperRifle.Single"
SWEP.Primary.Damage = 10
SWEP.Primary.TakeAmmo = 0
SWEP.Primary.ClipSize = 9999
SWEP.Primary.Ammo = "gauss"
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Spread = 0.0
SWEP.Primary.NumberofShots = 10
SWEP.Primary.Automatic = true
SWEP.Primary.Recoil = 0
SWEP.Primary.Delay = 1
SWEP.Primary.Force = 10
//Primary Fire Variables\\

//Secondary Fire Variables\\
SWEP.Secondary.Sound = "Weapon_StunStick.Swing"
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "gauss"
SWEP.Secondary.Recoil = 0
SWEP.Secondary.Delay = 1
SWEP.Secondary.TakeAmmo = 0
SWEP.Secondary.ClipSize = 1
//Secondary Fire Variables\\

//SWEP:Initialize()\\
function SWEP:Initialize()
util.PrecacheSound(self.Primary.Sound)
util.PrecacheSound(self.Secondary.Sound)
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType )
end
end
//SWEP:Initialize()\\

//SWEP:PrimaryFire()\\
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 0
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
self:ShootEffects()
self.Owner:FireBullets( bullet )
self.Weapon:EmitSound(Sound(self.Primary.Sound))
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end
//SWEP:PrimaryFire()\\

//SWEP:SecondaryFire()\\


if self.Secondary.NextFire > CurTime() then
return end

self.Secondary.NextFire = CurTime() + self.Secondary.Delay

if SWEP.Primary.Force == 10 then
SWEP.Primary.Force = 250
elseif SWEP.Primary.Force == 250 then
SWEP.Primary.Force = 1000
else
SWEP.Primary.Force = 10
end

if SWEP.Primary.Damage == 10 then
SWEP.Primary.Damage = 250
elseif SWEP.Primary.Damage == 250 then
SWEP.Primary.Damage = 1000
else
SSWEP.Primary.Damage = 10
end

end
//SWEP:SecondaryFire()\\

A.I.
07.10.2009, 13:45
Huh? Hast du alles in eine Datei gepackt?

Die Aufteilung in init.lua, cl_init.lua und shared.lua ist nicht umsonst da. ;)
Außerdem... was für ein Fehler wird von GMod überhaupt gemeldet?

RP-01
07.10.2009, 13:52
Die Aufteilung in init.lua, cl_init.lua und shared.lua ist nicht umsonst da. ;)

Man kann auch mit if SERVER then und if CLIENT then arbeiten, da braucht man kein 3 Dateien.

A.I.
07.10.2009, 13:55
Man kann auch mit if SERVER then und if CLIENT then arbeiten, da braucht man kein 3 Dateien.

Diese "ifs" konnte ich in seinem Code allerdings nicht finden.

frog
07.10.2009, 13:58
ne ich habe alle in einem gemacht weil ich noch net so genau weiß wie ichs aufteilen soll...leider...
aber das wird bald^^

hier der fehler+

weapons/weapon_shielddistruction/shared.lua:107: '<eof>' expected near 'end'

Pac_187
07.10.2009, 15:21
Mach das "end" bei:


if self.Secondary.NextFire > CurTime() then
return end


weg.

WeltEnSTurm
07.10.2009, 15:31
Mach das "end" bei:


if self.Secondary.NextFire > CurTime() then
return end


weg.

Nach nem return darf vor dem nächsten end (oder else) kein code mehr kommen, er kann die zeile komplett löschen.

Pac_187
07.10.2009, 15:51
Ja oder so...

frog
08.10.2009, 16:35
also so?

...
//SWEP:SecondaryFire()\\


if self.Secondary.NextFire > CurTime() then
return

if SWEP.Primary.Force == 10 then
SWEP.Primary.Force = 250
...

frog
20.10.2009, 16:17
wie denn jetzt?