Requested here: Officer down script!
/13
make this pop up:
Feel free to edit it how you see fit.
Client script
RegisterCommand('13', function(source, args, rawCommand)
local ped = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(ped, false))
local streetName, crossing = GetStreetNameAtCoord(x, y, z)
streetName = GetStreetNameFromHashKey(streetName)
local message = ""
if crossing ~= nil then
crossing = GetStreetNameFromHashKey(crossing)
message = "^1" .. GetPlayerName(source) .. " has called a 10-13 near ^3" .. streetName .. " ^1and ^3" .. crossing .. " ^1all units break and roll code 3."
else
message = "^1" .. GetPlayerName(source) .. " has called a 10-13 near ^3" .. streetName .. " ^1all units break and roll code 3."
end
TriggerServerEvent('sendChatMessage', message)
end, false)
Server script
RegisterServerEvent('sendChatMessage')
AddEventHandler('sendChatMessage', function(message)
TriggerClientEvent('chatMessage', -1, '', {255,255,255}, message)
end)
On button press
If you rather have this bound to the F6 key, use the following in your client.lua instead:
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustReleased(0, 167) then
local ped = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(ped, false))
local streetName, crossing = GetStreetNameAtCoord(x, y, z)
streetName = GetStreetNameFromHashKey(streetName)
local message = ""
if crossing ~= nil then
crossing = GetStreetNameFromHashKey(crossing)
message = "^1" .. GetPlayerName(PlayerId()) .. " has called a 10-13 near ^3" .. streetName .. " ^1and ^3" .. crossing .. " ^1all units break and roll code 3."
else
message = "^1" .. GetPlayerName(PlayerId()) .. " has called a 10-13 near ^3" .. streetName .. " ^1all units break and roll code 3."
end
TriggerServerEvent('sendChatMessage', message)
end
end
end)
Download in case you have trouble copying the code above
Download contains 3 folders, āelm-bothā, āelm-button-pressā, āelm-commandā, each containing the version suggested by the name. Only install one of them obviously.
Emergency Location Message.zip (4.6 KB)