Skip to content

Commit

Permalink
Merge pull request #847 from Gravxd/master
Browse files Browse the repository at this point in the history
fix(client/spectating) caching original routing bucket
  • Loading branch information
Blumlaut authored Jul 2, 2024
2 parents 7ce86e5 + aadcbda commit f1c15f0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ EasyAdmin is an Administration Suite for FiveM and RedM Servers, EasyAdmin is fe
- Actively Supported & Updated since 2017
- Plugin Support
- Fully integrated Discord Bot, including Discord ACE Permissions, Chat Bridge, Commands and Logs
- Configurable ban screens allowing server owners to modify to their colours/logo etc via our [easy to use convars](https://easyadmin.readthedocs.io/en/latest/config/#ban-screen-configuration)

![image](https://user-images.githubusercontent.com/13604413/126916981-1680e5ac-e024-467b-aad3-a5a9658449e0.png)

Expand All @@ -25,6 +26,8 @@ EasyAdmin is an Administration Suite for FiveM and RedM Servers, EasyAdmin is fe

![image](https://user-images.githubusercontent.com/13604413/126916989-f78d7b16-d20a-49ba-a559-6c3b56e98de5.png)

![image](https://github.com/Gravxd/EasyAdmin/assets/75702884/8a4e4694-5ff5-429a-986c-ab43148929a8)

### Dependencies

EasyAdmin requires FiveM's default `yarn` resource, this is included in [cfx-server-data](https://github.com/citizenfx/cfx-server-data) when installing the server.
Expand Down
4 changes: 3 additions & 1 deletion client/admin_client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ RegisterNetEvent("EasyAdmin:requestSpectate", function(playerServerId, playerDat

if playerData.selfbucket then
-- cache old bucket to restore at end of spectate
MyBucket = playerData.selfbucket
if not IsSpectating then
MyBucket = playerData.selfbucket
end
end

local tgtCoords = playerData.coords
Expand Down
4 changes: 4 additions & 0 deletions client/gui_c.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,21 @@ Citizen.CreateThread(function()
end
end)

IsSpectating = false

function DrawPlayerInfo(target)
drawTarget = target
drawServerId = GetPlayerServerId(target)
drawInfo = true
IsSpectating = true
DrawPlayerInfoLoop()
end

function StopDrawPlayerInfo()
drawInfo = false
drawTarget = 0
drawServerId = 0
IsSpectating = false
end

local banlistPage = 1
Expand Down
2 changes: 1 addition & 1 deletion server/admin_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ Citizen.CreateThread(function()
local playerBucket = GetPlayerRoutingBucket(playerId)
local sourceBucket = GetPlayerRoutingBucket(source)
if sourceBucket ~= playerBucket then
-- upon spectate request, the admin needs to be set to the target player
-- upon spectate request, the admin needs to be set to the target player's bucket if not already
SetPlayerRoutingBucket(source, playerBucket)
end
local playerData = { coords = tgtCoords, selfbucket = sourceBucket }
Expand Down

0 comments on commit f1c15f0

Please sign in to comment.