From 302375feb8acae033e1aef0b0c90d0f0819caefe Mon Sep 17 00:00:00 2001 From: yannikfolgmann <73497566+yannikfolgmann@users.noreply.github.com> Date: Fri, 9 Dec 2022 14:37:21 +0100 Subject: [PATCH] Fix Possibility For Modders To Execute Emotes For Everyone (#84) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to yannikfolgmann and iSentrie 🙏 --- server/Server.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/server/Server.lua b/server/Server.lua index 7147059..a7d8502 100644 --- a/server/Server.lua +++ b/server/Server.lua @@ -3,10 +3,38 @@ ----------------------------------------------------------------------------------------------------- RegisterNetEvent("ServerEmoteRequest", function(target, emotename, etype) + local ped = GetPlayerPed(source) + + if target == -1 then + return + end + local tped = GetPlayerPed(target) + local pedcoord = GetEntityCoords(ped) + local targetcoord = GetEntityCoords(tped) + + local distance = #(pedcoord - targetcoord) + + if distance > 3 then + return + end TriggerClientEvent("ClientEmoteRequestReceive", target, emotename, etype) end) RegisterNetEvent("ServerValidEmote", function(target, requestedemote, otheremote) + local ped = GetPlayerPed(source) + + if target == -1 then + return + end + local tped = GetPlayerPed(target) + local pedcoord = GetEntityCoords(ped) + local targetcoord = GetEntityCoords(tped) + + local distance = #(pedcoord - targetcoord) + + if distance > 3 then + return + end TriggerClientEvent("SyncPlayEmote", source, otheremote, target) TriggerClientEvent("SyncPlayEmoteSource", target, requestedemote, source) end)