From 9e3c41a58c236ea47583f941cfdc5760bed6dc7a Mon Sep 17 00:00:00 2001 From: BreezyTheDev <63890993+BreezyTheDev@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:26:56 -0700 Subject: [PATCH 1/3] Added pay commands. --- ND_Chat/source/server.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ND_Chat/source/server.lua b/ND_Chat/source/server.lua index 804d6b9..0c70894 100644 --- a/ND_Chat/source/server.lua +++ b/ND_Chat/source/server.lua @@ -51,6 +51,24 @@ if config["/twt"] then end, false) end +if config["pay"] then + RegisterCommand("pay", function(source, args, rawCommand) + local player = source + local target = tonumber(args[1]) + local amount = tonumber(args[2]) + NDCore.Functions.TransferBank(amount, player, target) + end, false) +end + +if config["give"] then + RegisterCommand(Settings.Give.Command, function(source, args, rawCommand) + local player = source + local amount = tonumber(args[2]) + NDCore.Functions.GiveCashToNearbyPlayer(player, amount) + end, false) +end + + function hasDarkWebPermission(player, players, args) for _, department in pairs(config["/darkweb"].canNotSee) do if players[player].job == department then @@ -87,4 +105,4 @@ if config["/911"].enabled then local player = source TriggerClientEvent("ND_Chat:911", -1, GetEntityCoords(GetPlayerPed(player)), table.concat(args, " ")) end, false) -end \ No newline at end of file +end From b90b6bc75dbc7f21133b543e2ed471dd42d5ec31 Mon Sep 17 00:00:00 2001 From: BreezyTheDev <63890993+BreezyTheDev@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:29:17 -0700 Subject: [PATCH 2/3] Update server.lua --- ND_Chat/source/server.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ND_Chat/source/server.lua b/ND_Chat/source/server.lua index 0c70894..4ed9b2c 100644 --- a/ND_Chat/source/server.lua +++ b/ND_Chat/source/server.lua @@ -61,7 +61,7 @@ if config["pay"] then end if config["give"] then - RegisterCommand(Settings.Give.Command, function(source, args, rawCommand) + RegisterCommand("give", function(source, args, rawCommand) local player = source local amount = tonumber(args[2]) NDCore.Functions.GiveCashToNearbyPlayer(player, amount) From d3bf85bd5b17f74d6c4693eddebcdc3a35fcd56b Mon Sep 17 00:00:00 2001 From: BreezyTheDev <63890993+BreezyTheDev@users.noreply.github.com> Date: Thu, 18 Aug 2022 09:40:11 -0700 Subject: [PATCH 3/3] Fixed errors to pay commands --- ND_Chat/source/server.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/ND_Chat/source/server.lua b/ND_Chat/source/server.lua index 4ed9b2c..1344c9b 100644 --- a/ND_Chat/source/server.lua +++ b/ND_Chat/source/server.lua @@ -53,18 +53,29 @@ end if config["pay"] then RegisterCommand("pay", function(source, args, rawCommand) - local player = source - local target = tonumber(args[1]) - local amount = tonumber(args[2]) - NDCore.Functions.TransferBank(amount, player, target) + local player = source + local target = tonumber(args[1]) + local amount = tonumber(args[2]) + if target and amount ~= nil then + NDCore.Functions.TransferBank(amount, player, target) + else + -- Wrong syntax, it's /pay + TriggerClientEvent('chatMessage', source, '^1ERROR: Wrong usage. /pay ') + end + end, false) end if config["give"] then RegisterCommand("give", function(source, args, rawCommand) local player = source - local amount = tonumber(args[2]) - NDCore.Functions.GiveCashToNearbyPlayer(player, amount) + local amount = tonumber(args[1]) + if amount ~= nil then + NDCore.Functions.GiveCashToNearbyPlayer(player, amount) + else + -- Wrong syntax, it's /give + TriggerClientEvent('chatMessage', source, '^1ERROR: Wrong usage. /give ') + end end, false) end