Skip to content

Commit

Permalink
fix(client): ensure valid networked entity for server events
Browse files Browse the repository at this point in the history
Should resolve #46
  • Loading branch information
thelindat committed Nov 21, 2022
1 parent c1eed9e commit 45ddd51
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ local function enableTargeting()
end
end


if hit and distance < 7 then
local newOptions
local lastZone = currentZone
Expand Down Expand Up @@ -305,8 +304,8 @@ local function getResponse(option, server)
response.coords = currentTarget.coords
response.distance = currentTarget.distance

if server and response.entity then
response.entity = NetworkGetNetworkIdFromEntity(response.entity)
if server then
response.entity = response.entity ~= 0 and NetworkGetEntityIsNetworked(response.entity) and NetworkGetNetworkIdFromEntity(response.entity) or 0
end

response.icon = nil
Expand Down

0 comments on commit 45ddd51

Please sign in to comment.