Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heal for redemrp_status #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion scripts/client/commands/misc.lua
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 4 additions & 4 deletions scripts/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 9 additions & 0 deletions scripts/server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down