From 71832114c87fddae03fc06de6890c60582c79f70 Mon Sep 17 00:00:00 2001 From: Andyyy7666 <86536434+Andyyy7666@users.noreply.github.com> Date: Sun, 23 Jan 2022 23:56:08 +0100 Subject: [PATCH] Update commands.lua Moved a lot of commands to server side, made them better, and added a /911 call. --- ND_Core/source/client/commands.lua | 43 ++++++++++++------------------ 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/ND_Core/source/client/commands.lua b/ND_Core/source/client/commands.lua index 0bcb023..aa78e9c 100644 --- a/ND_Core/source/client/commands.lua +++ b/ND_Core/source/client/commands.lua @@ -12,12 +12,12 @@ if config.enableAopCommand then { name="Area", help="Area of Play" } }) TriggerEvent("chat:addSuggestion", "/" .. config.checkAopCommand, "Check the current Area of Play.", {}) - RegisterCommand(config.checkAopCommand, function(source, args, raw) + RegisterCommand(config.checkAopCommand, function(source, args, rawCommand) TriggerServerEvent("getAop") end, false) - RegisterCommand(config.aopCommand, function(source, args, raw) + RegisterCommand(config.aopCommand, function(source, args, rawCommand) if admin then - TriggerServerEvent("registerAop", string.gsub(raw, config.aopCommand .. " ", "")) + TriggerServerEvent("registerAop", string.sub(rawCommand, string.len(config.aopCommand + 1), string.len(rawCommand))) else TriggerEvent("chat:addMessage", { args = {"~r~You don't have permission to set the aop."} @@ -48,31 +48,22 @@ if config.enableAopCommand then end) end --- Twotter command -RegisterCommand("twt", function(source, args, rawCommand) - TriggerServerEvent("twt", GetPlayerServerId(PlayerId()), mainTwtName, string.gsub(rawCommand, "twt", "")) -end, false) -RegisterNetEvent("twt") -AddEventHandler("twt", function(id, twtName, twt) +RegisterNetEvent("911") +AddEventHandler("911", function(coords, rawCommand) + local location = GetStreetNameFromHashKey(GetStreetNameAtCoord(coords.x, coords.y, coords.z)) TriggerEvent("chat:addMessage", { - template = " {0}: {1}", - multiline = true, - args = {"^4@" .. twtName .. " (#" .. id .. ")", twt} + color = {255, 0, 0}, + args = {"^*[911] ^3Location: " .. location .. " ^1| Call infomation^0", string.sub(rawCommand, 4, string.len(rawCommand))} }) -end) - --- Me command -RegisterCommand("me", function(source, args, rawCommand) - TriggerServerEvent("me", GetPlayerServerId(PlayerId()), mainFirstName .. " " .. mainLastName, string.gsub(rawCommand, "me", ""), GetEntityCoords(PlayerPedId())) -end, false) -RegisterNetEvent("me") -AddEventHandler("me", function(id, name, msg, coords) - if #(coords - GetEntityCoords(PlayerPedId())) < 19.999 then - TriggerEvent("chat:addMessage", { - color = {255, 0, 0}, - args = {"^*ME | ^0" .. name .. " (#" .. id .. ")", msg} - }) - end + blip = AddBlipForCoord(coords.x, coords.y, coords.z) + SetBlipSprite(blip, 817) + SetBlipAsShortRange(blip, true) + BeginTextCommandSetBlipName("STRING") + SetBlipColour(blip, 1) + AddTextComponentString("911 CALL: " .. location) + EndTextCommandSetBlipName(blip) + Citizen.Wait(60 * 1000) + RemoveBlip(blip) end) -- Change character command