• Custom Swep LUA errors
    4 replies, posted
been getting some errors with this swep... [code] if (SERVER) then AddCSLuaFile( "shared.lua" ) SWEP.Weight = 5; SWEP.AutoSwitchTo = false; SWEP.AutoSwitchFrom = false; end if (CLIENT) then SWEP.PrintName = "Blowtorch" SWEP.Slot = 3 SWEP.SlotPos = 1 SWEP.DrawAmmo = true SWEP.DrawCrosshair = true end SWEP.Author = "Nonono" SWEP.Instructions = "Not Today." SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_fire_extinguisher.mdl" SWEP.WorldModel = "models/weapons/w_fire_extinguisher.mdl" SWEP.Primary.ClipSize = 10 SWEP.Primary.DefaultClip = 10 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "357" SWEP.Primary.Delay = 0.1 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.ViewModelFlip = false local ShootSound = Sound("Metal.SawbladeStick") local TimeHeld = 0 function SWEP:PrimaryAttack() local tr = self.Owner:GetEyeTrace() playerSelf = self.Owner if tr.HitPos:Distance(self.Owner:GetShootPos()) > 80 then return else local tr = self.Owner:GetEyeTrace() if not tr.Entity:IsWorld() == true then if tr.Entity:IsDoor() == true then if (CLIENT) then print("Cannot use on a Door!") end elseif tr.Entity:IsPlayer() then if (CLIENT) then print("Cannot use on a Player!") end elseif tr.Entity:IsWeapon() then if (CLIENT) then print("Cannot use on a Weapon!") end elseif tr.Entity:IsVehicle() then if (CLIENT) then print("Cannot use on a Vehicle!") end elseif tr.Entity:IsNPC() then if (CLIENT) then print("Cannot use on an NPC!") end elseif ( self:Clip1() <= 0 ) then if (CLIENT) then self:EmitSound( "Weapon_Pistol.Empty" ) end elseif not ( tr.Entity:GetCollisionGroup() == COLLISION_GROUP_NONE ) then if (CLIENT) then print("Cannot use on this entity! It's wierd!") end else self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:EmitSound( ShootSound ) self:ShootEffects( self ) local effectdata = EffectData() effectdata:SetOrigin( tr.HitPos ) effectdata:SetNormal( tr.HitNormal ) effectdata:SetMagnitude( 1.5 ) effectdata:SetScale( 0.8 ) effectdata:SetRadius( 2 ) util.Effect( "Sparks", effectdata ) delayer(math.Rand(5,10)) if delayer() == true then TimeHeld = 0 mater = tr.Entity:GetMaterial() tr.Entity:SetNotSolid( true ) tr.Entity:SetMaterial( "sprites/heatwave" ) if (CLIENT) then local ply = LocalPlayer() ply:PrintMessage( HUD_PRINTTALK, "Finished Blowtorching!" ) end timer.Create( "tmr1", 5, 1, function() tr.Entity:SetNotSolid( false ) tr.Entity:SetMaterial(mater) end ) self:TakePrimaryAmmo(1) end end else if (CLIENT) then local ply = LocalPlayer() print("Cannot use on this entity!") end end if (!SERVER) then return end end end function delayer(t) if (CLIENT) then if TimeHeld == 100 then return true else TimeHeld = TimeHeld + 1 return false end end end function SWEP:SecondaryAttack() self:PrimaryAttack() end function SWEP:ShouldDropOnDie() return false end [/code] Im pretty good with lua, but i cant find whats wrong thats causing errors....
And of course you don't post the errors.
Meh - well i couldnt as i have about 55 people on my server :l And to install it i would have to restart it...
Single player?
[QUOTE=equallyhero;43466332]Meh - well i couldnt as i have about 55 people on my server :l And to install it i would have to restart it...[/QUOTE] Do a map change; will reload scripts without restarting.
Sorry, you need to Log In to post a reply to this thread.