• Last update broke my Door busting script.
    4 replies, posted
Hi. Since the new update, my door buster script hasn't been working anymore. Instead of spawning a single door prop, now it spawns 2, and to make matters worse it then fails the timer that is supposed to reset the door's position. the error: [code] [ERROR] lua/weapons/weapon_csgo_nova/shared.lua:308: attempt to call global 'ResetDoor' (a nil value) 1. unknown - lua/weapons/weapon_csgo_nova/shared.lua:308 Timer Failed! [Simple][@lua/weapons/weapon_csgo_nova/shared.lua (line 308)] [/code] The script [lua] function SWEP:CSShootBullet(dmg, recoil, numbul, cone) numbul = numbul or 1 cone = cone or 0.01 local bullet = {} bullet.Num = numbul bullet.Src = self.Owner:GetShootPos() -- Source bullet.Dir = self.Owner:GetAimVector() -- Dir of bullet bullet.Spread = Vector(cone, cone, 0) -- Aim Cone bullet.Tracer = 1 -- Show a tracer on every x bullets bullet.Force = 0.5 * dmg -- Amount of force to give to phys objects bullet.Damage = dmg -- Amount of damage to give to the bullets bullet.Callback = HitImpact bullet.Callback = function(attacker, tr, dmginfo) return self:RicochetCallback_Redirect(attacker, tr, dmginfo) end self.Owner:FireBullets(bullet) -- Fire the bullets self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK) -- View model animation self.Owner:SetAnimation(PLAYER_ATTACK1) -- 3rd Person Animation if ( (game.SinglePlayer() && SERVER) || ( !game.SinglePlayer() && CLIENT && IsFirstTimePredicted() ) ) then local eyeang = self.Owner:EyeAngles() eyeang.pitch = eyeang.pitch - (recoil * 1 * 0.5) eyeang.yaw = eyeang.yaw - (recoil * math.random(-1, 1) * 0.25) self.Owner:SetEyeAngles( eyeang ) end local trace = self.Owner:GetEyeTrace(); if trace.HitPos:Distance(self.Owner:GetShootPos()) > 250 or self.DestroyDoor == 0 then return end if trace.Entity:GetClass() == "prop_door_rotating" and (SERVER) then trace.Entity:Fire("open", "", 0.001) trace.Entity:Fire("unlock", "", 0.001) local pos = trace.Entity:GetPos() local ang = trace.Entity:GetAngles() local model = trace.Entity:GetModel() local skin = trace.Entity:GetSkin() local norm = (pos - self.Owner:GetPos()) local smoke = EffectData() smoke:SetOrigin(pos) util.Effect("effect_smokedoor", smoke) trace.Entity:SetNotSolid(true) trace.Entity:SetNoDraw(true) local function Reset(door, fakedoor) door:SetNotSolid(false) door:SetNoDraw(false) fakedoor:Remove() end local norm = (pos - self.Owner:GetPos()) norm:Normalize() local push = 10 * norm local ent = ents.Create("prop_physics") ent:SetPos(pos) ent:SetAngles(ang) ent:SetModel(model) if(skin) then ent:SetSkin(skin) end ent:Spawn() timer.Simple(0.01, function() if ent and push then ent:GetPhysicsObject():SetVelocity(push) end end) timer.Simple(0.01, function() if ent and push then ent:GetPhysicsObject():SetVelocity(push) end end) timer.Simple(25, function() ResetDoor( trace.Entity, ent, 10) end) end end [/lua]
Now is it actually your code? or someone else's. If it was yours you should be able to fix it easily.
its from madcow
Update your mad cow's weapons. Mine work fine.
Actually, the original was form the css_realistic base. I was rewriting the door busting script because it tended to cause lag in multiplayer. Anyway, i fixed the error. The problem was the function was called Reset while the timer was calling ResetDoor. The double doors was caused by the ricochet callback, so i just put a check to disable the callback when the bullet hits a door entity. Thanks for the help guys!
Sorry, you need to Log In to post a reply to this thread.