• Bullet Reflection
    7 replies, posted
hook.Add("EntityFireBullets","ReflectCoolBullets",function(ent,data)     if data.Reflected then  return  end     local attacker = data.Attacker     local trace = attacker:GetEyeTrace().HitPos     local tab = table.Copy(data)     tab.Reflected = true     tab.Dir = (attacker:GetPos() - trace):Normalize()     attacker:FireBullets(tab,false) end) Trying to run this but server crash Plz help me
infinite function execution
But it's check for it if data.Reflected then  return  end
So tab = a copy of data Then you set tab.value to true But then you test for data.value, which is never changed...
Change the data table and return true in the hook.
tab.Reflected = true attacker:FireBullets(tab,false) tab using for next bullet not for current
You must return true after you make changes to the bulletdata structure to apply all the new settings.
No, you don't have to return anything here. This is not going to get you an accurate bullet trace, and I'm not sure what will: local trace = attacker:GetEyeTrace().HitPos It's possible that the call to FireBullets is ingesting the Lua table, ignoring anything not part of the structure, and building a new one for the next time the hook is called. If you're still having issues in like six hours I might try fixing this.
Sorry, you need to Log In to post a reply to this thread.