• Need help trying to fix code for an addon i'm trying to edit?
    1 replies, posted
Hello. This is one of my first time on the facepunch forums, and i've been trying to edit a swep me and a friend previously fixed up to add code i have been working on. (I won't disclose the name due to rules of "Bragging" being broken if i say anything about it) So basically what was happening is that i tried to add code to allow a random sound of 2 sounds to be played, which to an extent worked. However, the swep is supposed to give a player higher movement speed and jump height, and when non deployed, it should go away. after deploying and switching to another weapon from the swep, the effects do not revert back. there is code present that is supposed to change it. I'll paste the LUA in full, but i don't know if i'll be pasting it right. [CODE]if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "thrown" end if ( CLIENT ) then SWEP.PrintName = "Shrecktacular Mote" SWEP.Author = "Nyaaaa & level94836" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "Primary:1 Hit kill, Elimitates Players, NPC's (1 sec cooldown) Seconday: Ragdoll Players/NPCS infront you (15 sec cooldown)!" SWEP.Slot = 1 SWEP.SlotPos = 1 SWEP.IconLetter = "h" killicon.AddFont( "weapon_knife", "CSKillIcons", SWEP.IconLetter, Color( 255, 255, 255, 255 ) ) end SWEP.DrawCrosshair = true SWEP.DrawAmmo = false SWEP.Spawnable = true SWEP.AdminOnly = true SWEP.Category = "Wiimote Admin" SWEP.ViewModel = "models/weapons/v_wiimote_meow.mdl" SWEP.WorldModel = "models/weapons/w_wiimote_meow.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false SWEP.Primary.Recoil = 0 SWEP.Primary.Damage = 9999 SWEP.Primary.NumShots = 0 SWEP.Primary.Cone = 0 SWEP.Primary.ClipSize = 1 SWEP.Primary.Delay = 0.01 SWEP.Primary.DefaultClip = 1 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "none" SWEP.Secondary.Recoil = 0.0 SWEP.Secondary.Damage = 9999 SWEP.Secondary.NumShots = 1 SWEP.Secondary.Cone = 0.0 SWEP.Secondary.ClipSize = 9999 SWEP.Secondary.Delay = 0.0 SWEP.Secondary.DefaultClip = 9998 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" local function PreCaCheSoundS(dir) local f = file.Find(dir,"GAME") for k,v in pairs(f) do print(v) end end PreCaCheSoundS("shrek/*") function SWEP:Initialize() util.PrecacheModel("weapons/v_wiimote_meow.mdl") util.PrecacheModel("weapons/w_wiimote_meow.mdl") util.PrecacheSound("shrek/roar.mp3") --shrek/shreked.mp3 AddAllFilesSound("sound/saxton") self.SaxWepTime = 0 if (SERVER) then self.Owner:SetJumpPower(self.Owner:GetJumpPower()*2) self.Owner:SetRunSpeed(self.Owner:GetRunSpeed()*4) self.Owner:SetWalkSpeed(self.Owner:GetWalkSpeed()*4) self.Owner:SetHealth(19250) self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) end end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end self:TakePrimaryAmmo( 0 ) local ent = self.Owner:GetEyeTrace().Entity if IsValid(ent) and self.Owner:GetShootPos():Distance(ent:GetPos()) <= 85 and ent:IsPlayer() or self.Owner:GetShootPos():Distance(ent:GetPos()) <= 85 and ent:IsNPC() then self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:EmitSound(Sound("shrek/holdonnow.mp3")) self.Owner:ViewPunch( Angle( 0, 0, 0 ) ) if SERVER then local ragdoll = ragdoll or ent if ent:IsPlayer() then ent:CreateRagdoll() ent:KillSilent() ragdoll = ent:GetRagdollEntity() self.Owner:AddFrags(1) end local dissolver = ents.Create( "env_entity_dissolver" ) dissolver:SetPos(ragdoll:GetPos()) dissolver:SetKeyValue( "dissolvetype", 3 ) dissolver:Spawn() dissolver:Activate() local name = "Kill_"..tostring(ragdoll:EntIndex()) ragdoll:SetName( name ) dissolver:Fire( "Dissolve", name, 0 ) dissolver:Fire( "Kill", ragdoll, 0.10 ) end elseif self.Owner:GetPos():Distance(ent:GetPos()) > 95 then self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) self.Weapon:EmitSound(Sound("shrek/ohnononoo.mp3")) end self.Weapon:SetNextPrimaryFire( CurTime() + 1 ) end function SWEP:SecondaryAttack() for k,v in pairs(ents.FindInSphere(self.Owner:GetPos(), 500)) do if IsValid(self.Owner) and IsValid(v) and self.Owner ~= v then if v:IsPlayer() then v:SetHealth(10) if SERVER then local owner = v if IsValid(owner) then owner:SetVelocity(self.Owner:GetUp() * 10000 + self.Owner:GetRight() * 6000) end end end if v:IsNPC() then if SERVER then local dissolver = ents.Create( "env_entity_dissolver" ) dissolver:SetPos(v:GetPos()) dissolver:SetKeyValue( "dissolvetype", 3 ) dissolver:Spawn() dissolver:Activate() local name = "Kill_"..tostring(v:EntIndex()) v:SetName( name ) dissolver:Fire( "Dissolve", name, 0 ) dissolver:Fire( "Kill", v, 0.10 ) end end end end self.Owner:EmitSound(Sound("shrek/roar.mp3")) self.Weapon:SetNextSecondaryFire( CurTime() + 15 ) end /*--------------------------------------------------------- Deploy ---------------------------------------------------------*/ function SWEP:Deploy() if (SERVER) then if math.random(1,2) == 1 then self.Weapon:EmitSound(Sound("shrek/somuch.mp3")) self.Owner:SetJumpPower(self.Owner:GetJumpPower()*2) self.Owner:SetRunSpeed(self.Owner:GetRunSpeed()*4) self.Owner:SetWalkSpeed(self.Owner:GetWalkSpeed()*4) self.Owner:SetHealth(19250) else self.Weapon:EmitSound(Sound("shrek/shreked.mp3")) self.Owner:SetJumpPower(self.Owner:GetJumpPower()*2) self.Owner:SetRunSpeed(self.Owner:GetRunSpeed()*4) self.Owner:SetWalkSpeed(self.Owner:GetWalkSpeed()*4) self.Owner:SetHealth(19250) end end /*--------------------------------------------------------- Holster ---------------------------------------------------------*/ function SWEP:Holster() if (SERVER) then self.Owner:SetJumpPower(200) self.Owner:SetRunSpeed(500) self.Owner:SetWalkSpeed(200) self.Owner:SetHealth(100) end end end [/CODE]
thats not the normal speeds and heights that u set please check them i think jump is 160 cant remember of the top of my head
Sorry, you need to Log In to post a reply to this thread.