Skip to content

Commit

Permalink
update to beta v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
STRAXXYHUBBZ committed Oct 5, 2022
1 parent d9086cc commit d15e551
Show file tree
Hide file tree
Showing 4 changed files with 147 additions and 21 deletions.
11 changes: 10 additions & 1 deletion client.lua
Expand Up @@ -5,4 +5,13 @@ TriggerEvent('chat:addSuggestion', '/911', 'Sends an emergency call to the local
TriggerEvent('chat:addSuggestion', '/panic', 'Press your panic button, sending a signal to all OnDuty Units!!', {
{ name="Postal/Street", help="Example: 362" },

})
})



RegisterCommand("911", function(source, args, playerpedinfo)
TriggerServerEvent("911:createCall", GetPlayerServerId(), args, GetPlayerName(source))
local playerPos = GetEntityCoords(PlayerPedId())
TriggerServerEvent("911:setBlip", "911 Call", playerPos.x, playerPos.y, playerPos.z)
end, false)

23 changes: 23 additions & 0 deletions config.lua
@@ -0,0 +1,23 @@
Config = {}



----[[PREFIX SETTING]]----

--[[
Code Color
^0 White
^1 Red
^2 Green
^3 Yellow
^4 Blue
^5 Light Blue
^6 Purple
^7 White
^8 Orange
^9 Grey
]]

Config.enable = true
Config.prefix = "^6[^0^*RoleplayRP^r^6]^0 "

4 changes: 3 additions & 1 deletion fxmanifest.lua
@@ -1,6 +1,6 @@
game 'common'

fx_version 'cerulean'
fx_version 'adamant'
author 'Obliviox'
description 'A 911 script that is only shown to onduty officers.'

Expand All @@ -9,3 +9,5 @@ lua54 'yes'
client_script "client.lua"

server_script "server.lua"

shared_script "config.lua"
130 changes: 111 additions & 19 deletions server.lua
Expand Up @@ -2,7 +2,7 @@
───────────────────────────────────────────────────────────────
OnDuty911 (server.lua) - Created by Obliviox
Current Version: v1.7.1 (Sep 2021)
Current Version: v0.2.0B (10/3/222)
──────────────────────────────
| Support: COMING SOON!!!! |
──────────────────────────────
Expand All @@ -12,6 +12,9 @@
───────────────────────────────────────────────────────────────
]]

if Config.enable == false then
Config.prefix = ""
end


Citizen.CreateThread(function()
Expand All @@ -21,7 +24,7 @@ Citizen.CreateThread(function()
end
end)
local resourceName =
[[^3
[[^4Credits to LegacysMaps for the blipcode help!^3
____ _____ _ ___ __ __
/ __ \ | __ \ | | / _ \/_ /_ |
| | | |_ __ | | | |_ _| |_ _ | (_) || || |
Expand All @@ -32,22 +35,26 @@ local resourceName =
|___/ ^7
^6OnDuty911
^0Created By Obliviox
/911
/panic
^0Created By ^1Obli^5viox^0
^1/911
^1/panic^0
]]

print()
print()
print(resourceName)
RegisterCommand("911", function(source, args)
print()
print()

RegisterNetEvent('911:createCall')
AddEventHandler('911:createCall', function(source, args)
if not table.unpack(args) then
TriggerClientEvent('chatMessage', -1, '^6[^0^*SVRP^r^6]^0 ' .. '^1Please specify a postal and description!')
TriggerClientEvent('chat:addMessage', -1, Config.prefix .. '^1Please specify a postal and description!')

else
TriggerClientEvent('chatMessage', -1, '^6[^0^*SVRP^r^6]^0 ' .. '^1911 ^2^*Successfully ^r^2sent!')
TriggerClientEvent('chat:addMessage', -1, Config.prefix .. '^1911 ^2^*Successfully ^r^2sent!')
vIsOnDuty = exports.PoliceEMSActivity:isOnDuty()
if vIsOnDuty == true then
TriggerClientEvent('t-notify:client:Custom', source, {
TriggerClientEvent('t-notify:client:Custom', -1, {
style = 'error',
duration = 35000,
title = "New 911",
Expand All @@ -57,21 +64,63 @@ RegisterCommand("911", function(source, args)
})
end
end
end)

RegisterNetEvent('911:setBlip')
AddEventHandler('911:setBlip', function(name, xCoord, yCoord, zCoord)

------ Forked from BlipAdder
local blips = {
{title="911 Call", colour=5, id=792, x = xCoord, y = yCoord, z = zCoord}
}

Citizen.CreateThread(function()

for _, info in pairs(blips) do
info.blip = AddBlipForCoord(xCoord, yCoord, zCoord)
SetBlipSprite(info.blip, 162)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 1.5)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING");
AddTextComponentString("911 Report - " + name);
EndTextCommandSetBlipName(info.blip);
end
end)


if vIsOnDuty == true then
------- Code from https://legacysmaps.tebex.io/ ||| Thanks for the code legacy!
local displayTime = 10
blip = AddBlipForCoord(xCoord, yCoord, zCoord)
SetBlipSprite(blip, 4)
SetBlipScale(blip, 0.3)
SetBlipColour(blip, 4)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('911 Call - ' .. name)
EndTextCommandSetBlipName(blip)
table.insert(blips, blip)
Wait(displayTime)
for i, blip in pairs(blips) do
RemoveBlip(blip)
end
end
end)


end, false)

RegisterCommand("panic", function(source, args)

if not table.unpack(args) then
TriggerClientEvent('chatMessage', -1, '^6[^0^*SVRP^r^6]^0 ' .. '^1Please specify a postal/street!')
TriggerClientEvent('chat:addMessage', -1, Config.prefix .. '^1Please specify a postal/street!')

else
TriggerClientEvent('chatMessage', -1, '^6[^0^*SVRP^r^6]^0 ' .. '^1^*PANIC BUTTON PRESSED. UNITS WILL ARRIVE TO YOUR LOCATION ASAP')
TriggerClientEvent('chat:addMessage', -1, Config.prefix .. '^1^*PANIC BUTTON PRESSED. UNITS WILL ARRIVE TO YOUR LOCATION ASAP')
vIsOnDuty = exports.PoliceEMSActivity:isOnDuty()
-- if vIsOnDuty == true then
TriggerClientEvent('t-notify:client:Custom', source, {
if vIsOnDuty == true then

TriggerClientEvent('t-notify:client:Custom', -1, {
style = 'error',
duration = 50000,
message = GetPlayerName(source) .. " triggered their panic button!",
Expand All @@ -81,23 +130,66 @@ RegisterCommand("panic", function(source, args)
Citizen.Wait(50)

Citizen.Wait(50)
TriggerClientEvent('t-notify:client:Custom', source, {
TriggerClientEvent('t-notify:client:Custom', -1, {
style = 'error',
duration = 100000,
message = "**Location Pressed**: " .. table.concat(args, " "),
sound = true,
custom = true
})
TriggerClientEvent('t-notify:client:Custom', source, {
TriggerClientEvent('t-notify:client:Custom', -1, {
style = 'error',
duration = 100000,
title = "Signal 100",
message = "**SIGNAL 100 IS NOW IN EFFECT!!**\nEMERGENCY RTO TRAFFIC ONLY!!!",
sound = true,
custom = true
})
-- end
end
end


RegisterNetEvent('911:setBlipPanic')
AddEventHandler('911:setBlipPanic', function(name, xCoord, yCoord, zCoord)

------ Forked from BlipAdder
local blips = {
{title="911 Call", colour=5, id=792, x = xCoord, y = yCoord, z = zCoord}
}

Citizen.CreateThread(function()

for _, info in pairs(blips) do
info.blip = AddBlipForCoord(xCoord, yCoord, zCoord)
SetBlipSprite(info.blip, 162)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 1.5)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING");
AddTextComponentString("911 Report - " + name);
EndTextCommandSetBlipName(info.blip);
end
end)


if vIsOnDuty == true then
------- Code from https://legacysmaps.tebex.io/ ||| Thanks for the code legacy!
local displayTime = 10
blip = AddBlipForCoord(xCoord, yCoord, zCoord)
SetBlipSprite(blip, 4)
SetBlipScale(blip, 0.3)
SetBlipColour(blip, 4)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('911 Call - ' .. name)
EndTextCommandSetBlipName(blip)
table.insert(blips, blip)
Wait(displayTime)
for i, blip in pairs(blips) do
RemoveBlip(blip)
end
end
end)


end, false)

0 comments on commit d15e551

Please sign in to comment.