Skip to content

Commit

Permalink
Prevent self spectate / invalid player
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathu-lmn committed Jul 9, 2024
1 parent e13c118 commit b98f21e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ RegisterNetEvent('qb-admin:client:spectate', function(targetPed)
local myPed = PlayerPedId()
local targetplayer = GetPlayerFromServerId(targetPed)
local target = GetPlayerPed(targetplayer)
if target == myPed then
return
end
if not isSpectating then
isSpectating = true
SetEntityVisible(myPed, false) -- Set invisible
Expand Down

0 comments on commit b98f21e

Please sign in to comment.