Announcement

Collapse
No announcement yet.

[Lua] OnPlayerWeaponShot doing messed up things

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Lua] OnPlayerWeaponShot doing messed up things

    Hello there! I have found out that the OnPlayerWeaponShot function is quite messy.
    • If there is no hit, then there is no normals, no usable data
    • Parameters do not match the documented version, in fact I noticed some variation of received parameters depending on hitting the ground, hitting nothing, hitting something in front of you, being on server or client side
    • On client side it does not provide a weapon identifier
    I'll gather some pictures as soon as I am able to, and describe how I got the said data.
    I have tried to figure out, what and where do I receive with some good old outputs.
    Code:
    AddEvent("OnPlayerWeaponShot", function(...)
        for i, v in pairs({...}) do
            AddPlayerChat(i.." | "..v)
        end
    end)
    I have also set up a table, that I could use to associate indices with strings, so I was more readable.

    I have tried to create a script which records the source and direction of every shot and draws a 3D line with the data (even if there was no recorded hit), but I was unable to because most of the time I did not get usable data.
Working...
X