diff --git a/ND_Core/source/server/commands.lua b/ND_Core/source/server/commands.lua index b2268f1..cbe6299 100644 --- a/ND_Core/source/server/commands.lua +++ b/ND_Core/source/server/commands.lua @@ -25,30 +25,58 @@ AddEventHandler("getAop", function() TriggerClientEvent("returnAop", player, aop) end) --- Twotter command event -RegisterNetEvent("twt") -AddEventHandler("twt", function(id, twtName, twt) - TriggerClientEvent("twt", -1, id, twtName, twt) -end) +-- Twotter command +RegisterCommand("twt", function(source, args, rawCommand) + local player = source + local twtName = onlinePlayers[player].twt + TriggerClientEvent("chat:addMessage", -1, { + template = " {0}: {1}", + multiline = true, + args = {"^4@" .. twtName .. " (#" .. player .. ")", string.sub(rawCommand, 4, string.len(rawCommand))} + }) +end, false) --- Me command event -RegisterNetEvent("me") -AddEventHandler("me", function(id, name, msg, coords) - TriggerClientEvent("me", -1, id, name, msg, coords) -end) +-- Me command +RegisterCommand("me", function(source, args, rawCommand) + local player = source + local playerCoords = GetEntityCoords(GetPlayerPed(player)) + for k, _ in pairs(onlinePlayers) do + local targetCoords = GetEntityCoords(GetPlayerPed(k)) + if (#(playerCoords - targetCoords) < 19.999) then + local name = onlinePlayers[player].firstName .. " " .. onlinePlayers[player].lastName + TriggerClientEvent("chat:addMessage", k, { + color = {255, 0, 0}, + args = {"^*ME | ^0" .. name .. " (#" .. player .. ")", string.sub(rawCommand, 3, string.len(rawCommand))} + }) + end + end +end, false) -- OOC command event RegisterCommand("ooc", function(source, args, rawCommand) + local player = source TriggerClientEvent("chat:addMessage", -1, { color = {150, 150, 150}, - args = {"^*OOC | ^0" .. GetPlayerName(source) .. " (#" .. source .. ")", string.gsub(rawCommand, "ooc", "")} + args = {"^*OOC | ^0" .. GetPlayerName(player) .. " (#" .. player .. ")", string.sub(rawCommand, 4, string.len(rawCommand))} }) end, false) -- Darkweb command event RegisterCommand("darkweb", function(source, args, rawCommand) + local player = source TriggerClientEvent("chat:addMessage", -1, { color = {0, 0, 0}, - args = {"^*Dark web | ^0Anonymous (#" .. source .. ")", string.gsub(rawCommand, "darkweb", "")} + args = {"^*Dark web | ^0Anonymous (#" .. player .. ")", string.sub(rawCommand, 8, string.len(rawCommand))} }) end, false) + +-- 911 command event +RegisterCommand("911", function(source, args, rawCommand) + local player = source + for k, v in pairs(onlinePlayers) do + if v.department ~= "CIV" then + local coords = GetEntityCoords(GetPlayerPed(player)) + TriggerClientEvent("911", k, coords, rawCommand) + end + end +end, false)