• EntityFireBullets outputting 0 damage for all weapons
    2 replies, posted
[lua] hook.Add("EntityFireBullets","FireBulletsTest",function(ply,tbl) print(tbl.Damage) end) [/lua] Prints 0 in console. PrintTable-ing tbl gives something similar to [lua] AmmoType = Pistol Attacker = [NULL Entity] Damage = 0 Dir = 0.073956 -0.901247 -0.426948 Distance = 56755.83984375 Force = 1 HullSize = 0 Num = 1 Spread = 0.008730 0.008730 0.008730 Src = -314.517700 -1836.989746 -12192.468750 Tracer = 2 [/lua] Why is this?
I think that function only returns the right damage if it's a SWEP that fires the bullets (I just checked and I think that's the case) - it'd be good if we could get a fix for this [editline]18th March 2016[/editline] Also, in the example above, you were doing [CODE] function(ply,tbl) [/CODE] when [URL="https://wiki.garrysmod.com/page/GM/EntityFireBullets"]the wiki[/URL] says 'ply' can be [B]any[/B] entity, not just a player... just wanted to point that out [URL="https://facepunch.com/showthread.php?t=1497739&p=49956655&viewfull=1#post49956655"]I posted this in the Next Update thread[/URL] (hopefully it'll get fixed)
[QUOTE=MPan1;49956639]I think that function only returns the right damage if it's a SWEP that fires the bullets (I just checked and I think that's the case) - it'd be good if we could get a fix for this [editline]18th March 2016[/editline] Also, in the example above, you were doing [CODE] function(ply,tbl) [/CODE] when [URL="https://wiki.garrysmod.com/page/GM/EntityFireBullets"]the wiki[/URL] says 'ply' can be [B]any[/B] entity, not just a player... just wanted to point that out[/QUOTE] Yeah, I trimmed the code down for the thread. The original code checked if it was a player first But thanks! :D
Sorry, you need to Log In to post a reply to this thread.