Skip to content

Instantly share code, notes, and snippets.

@CaptainStabs
Created October 19, 2023 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CaptainStabs/c0032d957e4d8a39d4e7c08ef17254a0 to your computer and use it in GitHub Desktop.
Save CaptainStabs/c0032d957e4d8a39d4e7c08ef17254a0 to your computer and use it in GitHub Desktop.
919admin log message
RegisterNetEvent("919-admin:server:MonetaryAction", function(targetId, action, amount)
local src = source
if AdminPanel.HasPermission(src, "givetakemoney") then
if action == "givecash" then
Compat.PlayerActions.AddMoney(targetId, amount)
print("TARGETID", targetId)
print("name", getCharName(targetId))
local logMessage = string.format("**STAFF MEMBER %s** added £%d to **%s[%d]** (%s)'s **wallet**", GetPlayerName(src), amount, GetPlayerName(targetId), targetId, getCharName(targetId))
TriggerEvent("qb-log:server:CreateLog", "adminactions", "MONEY", "red", logMessage, false)
TriggerClientEvent("919-admin:client:ShowPanelAlert", source, "success", "<strong>"..Lang:t("alerts.success").."</strong> "..Lang:t("alerts.gaveCash", {value = amount, value2 = GetPlayerName(targetId)}))
elseif action == "removecash" then
Compat.PlayerActions.RemoveMoney(targetId, amount)
local logMessage = string.format("**STAFF MEMBER %s** removed £%d from **%s[%d]** (%s)'s **wallet**", GetPlayerName(src), amount, GetPlayerName(targetId), targetId, getCharName(targetId))
TriggerEvent("qb-log:server:CreateLog", "adminactions", "MONEY", "red", logMessage, false)
TriggerClientEvent("919-admin:client:ShowPanelAlert", source, "success", "<strong>"..Lang:t("alerts.success").."</strong> "..Lang:t("alerts.removeCash", {value = amount, value2 = GetPlayerName(targetId)}))
elseif action == "givebank" then
Compat.PlayerActions.AddBank(targetId, amount)
local logMessage = string.format("**STAFF MEMBER %s** added £%d to **%s[%d]** (%s)'s **bank**", GetPlayerName(src), amount, GetPlayerName(targetId), targetId, getCharName(targetId))
TriggerEvent("qb-log:server:CreateLog", "adminactions", "MONEY", "red", logMessage, false)
TriggerClientEvent("919-admin:client:ShowPanelAlert", source, "success", "<strong>"..Lang:t("alerts.success").."</strong> "..Lang:t("alerts.gaveBank", {value = amount, value2 = GetPlayerName(targetId)}))
elseif action == "removebank" then
Compat.PlayerActions.RemoveBank(targetId, amount)
local logMessage = string.format("**STAFF MEMBER %s** removed £%d from **%s[%d]** (%s)'s **bank**", GetPlayerName(src), amount, GetPlayerName(targetId), targetId, getCharName(targetId))
TriggerEvent("qb-log:server:CreateLog", "adminactions", "MONEY", "red", logMessage, false)
TriggerClientEvent("919-admin:client:ShowPanelAlert", source, "success", "<strong>"..Lang:t("alerts.success").."</strong> "..Lang:t("alerts.removeBank", {value = amount, value2 = GetPlayerName(targetId)}))
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment