From 9864397c6e60c032a21fc9a41813ab1ab675b6cc Mon Sep 17 00:00:00 2001 From: btwentyone <35628565+btwentyone@users.noreply.github.com> Date: Fri, 20 May 2022 21:48:49 +0200 Subject: [PATCH 1/2] Heal for redemrp_status --- README.md | 1 + scripts/client/commands/misc.lua | 6 +++++- scripts/server/events.lua | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 61eb362..36532c9 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Other scripts that are required for this script to run on your server: - [rdrp_logs](https://github.com/NeonOdyssey/rdrp_logs) - *this is used for logging to console and dedicated discord channels via webhooks* +- [redemrp_status](https://github.com/RedEM-RP/redemrp_status) - *A status, basic needs system for RedEM:RP Framework* ## Features diff --git a/scripts/client/commands/misc.lua b/scripts/client/commands/misc.lua index 66b8633..f6247d8 100644 --- a/scripts/client/commands/misc.lua +++ b/scripts/client/commands/misc.lua @@ -1,9 +1,13 @@ RegisterNUICallback('heal', function(data, cb) data.staff = GetPlayerName(PlayerId()) - + TriggerServerEvent('rdrp_admin:heal', source, data, Config.Perms.Heal) end) RegisterNUICallback('spectate', function(data, cb) data.staff = GetPlayerName(PlayerId()) TriggerServerEvent('rdrp_admin:spectate', source, data, Config.Perms.Spectate ) +end) + +RegisterNetEvent('rdrp_admin:heal', function(data) + TriggerServerEvent('redemrp_status:AddAmount', 100, 100) end) \ No newline at end of file diff --git a/scripts/server/events.lua b/scripts/server/events.lua index 916a8b6..059e66b 100644 --- a/scripts/server/events.lua +++ b/scripts/server/events.lua @@ -23,6 +23,15 @@ AddEventHandler('rdrp_admin:goto', function(src, data, perms) end end) +RegisterServerEvent('rdrp_admin:heal') +AddEventHandler('rdrp_admin:heal', function(src, data, perms) + if checkPerms(src, perms) then + TriggerClientEvent('rdrp_admin:heal', data.player, data.data) + exports.rdrp_logs:console(data.staff.." heal to "..player(data.player), GetCurrentResourceName(), "info") + exports.rdrp_logs:discord(data.staff.." heal to "..player(data.player), "admin", GetCurrentResourceName(), "/goto", {{["name"] = "Coords", ["value"] = jason.encode(coords)}}) + end +end) + RegisterServerEvent('rdrp_admin:bring') AddEventHandler('rdrp_admin:bring', function(src, data, perms) if checkPerms(src, perms) then From e81a17dfcfd98b147e2d7130733b10955fec4ef1 Mon Sep 17 00:00:00 2001 From: btwentyone <35628565+btwentyone@users.noreply.github.com> Date: Sat, 21 May 2022 01:54:00 +0200 Subject: [PATCH 2/2] Replacement for player loops --- scripts/client/main.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/client/main.lua b/scripts/client/main.lua index bf91990..589c523 100644 --- a/scripts/client/main.lua +++ b/scripts/client/main.lua @@ -57,10 +57,10 @@ end) -- Get all players in server function getPlayersAll() local players = {} - for i = 0, 32 do - if NetworkIsPlayerActive(i) then - table.insert(players, {id = GetPlayerServerId(i), name = GetPlayerName(i)}) - end + + for _, player in ipairs(GetActivePlayers()) do + table.insert(players, {id = GetPlayerServerId(player), name = GetPlayerName(player)}) end + return players end \ No newline at end of file