Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local emergencycall=0
- local callPos=0
- local senderPosP
- local senderPosEMS
- local senderPosFire
- local callerBlipP
- local callerBlipEMS
- local callerBlipFire
- local pCallQ=0
- local emsCallQ=0
- local fireCallQ=0
- --911 Dispatcher
- CreateThread(function()
- while true do
- Wait(0)
- if(emergencycall==1) then
- if IsGameKeyboardKeyJustPressed(79) then
- emergencycall=0
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Contacting the Police department...")
- Wait(5000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1The Police department dispatched units to your current location...")
- Wait(2000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...[call ended]")
- TriggerServerEvent('911callService', 1)
- end
- if IsGameKeyboardKeyJustPressed(80) then
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Contacting EMS services...")
- emergencycall=0
- Wait(5000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1EMS dispatched units to your current location...")
- Wait(2000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...[call ended]")
- TriggerServerEvent('911callService', 2)
- end
- if IsGameKeyboardKeyJustPressed(81) then
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Contacting the Fire department...")
- emergencycall=0
- Wait(5000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1The Fire department dispatched units to your current location...")
- Wait(2000)
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...[call ended]")
- TriggerServerEvent('911callService', 3)
- end
- end
- end
- end)
- AddEventHandler('911Call', function(amount)
- CreateThread(function()
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1911, What's your emergency?...")
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Dial 1 ^5(NumPad1) ^1to contact the Police department...")
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Dial 2 ^5(NumPad2) ^1to contact EMS services...")
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Dial 3 ^5(NumPad3) ^1to contact the Fire department.")
- emergencycall=1
- Wait(15000)
- if(emergencycall==1) then TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Sir, are you still on the line?...")
- else return
- end
- Wait(15000)
- if(emergencycall==1) then TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...Sorry, someone else might need the line...")
- else return
- end
- TriggerEvent('chatMessage', '911', { 0, 0x99, 255 }, "^1...(call ended)")
- emergencycall=0
- end)
- end)
- AddEventHandler('911callPolice', function(senderid)
- CreateThread(function()
- local sender = GetPlayerByServerId(tonumber(senderid))
- senderPosP = table.pack(GetCharCoordinates(sender.ped, _f, _f, _f))
- if(IsCharModel(GetPlayerPed(), GetHashKey("M_Y_COP", _r)) or IsCharModel(GetPlayerPed(), GetHashKey("M_Y_COP_TRAFFIC", _r)) or IsCharModel(GetPlayerPed(), GetHashKey("M_Y_STROOPER", _r)) or IsCharModel(GetPlayerPed(), GetHashKey("M_M_FBI", _r)) or IsCharModel(GetPlayerPed(), GetHashKey("M_M_FATCOP_01", _r))) then
- pCallQ=1
- end
- end)
- end)
- CreateThread(function()
- while true do
- Wait(0)
- if(pCallQ==1) then
- ShowText("~b~911 call in progress. Press ~g~E ~b~to accept it or ~r~N ~b~to deny it", 500)
- if IsGameKeyboardKeyJustPressed(18) then
- RequestAnims("cop_wander_radio")
- while not HaveAnimsLoaded("cop_wander_radio") do Wait(0) end
- TaskPlayAnimSecondaryUpperBody(GetPlayerPed(), "walk_answer_radio_a", "cop_wander_radio", 9.9, 0, 0, 0, 1, -2)
- callerBlipP = AddBlipForCoord(senderPosP[1], senderPosP[2], senderPosP[3], _i)
- ChangeBlipSprite(callerBlipP, 33)
- ChangeBlipColour(callerBlipP, 3)
- SetBlipAsShortRange(callerBlipP, true)
- SetRoute(callerBlipP, true)
- EnableGpsInVehicle(GetCarCharIsUsing(GetPlayerPed(), _i), true)
- callPos=1
- ShowText("~b~Call accepted. Proceed to destination.", 10000)
- pCallQ=0
- Wait(5000)
- ClearCharTasks(GetPlayerPed())
- elseif IsGameKeyboardKeyJustPressed(49) then
- RequestAnims("cop_wander_radio")
- while not HaveAnimsLoaded("cop_wander_radio") do Wait(0) end
- TaskPlayAnimSecondaryUpperBody(GetPlayerPed(), "walk_answer_radio_a", "cop_wander_radio", 9.9, 0, 0, 0, 1, -2)
- pCallQ=0
- ShowText("~r~Call denied.", 7000)
- Wait(5000)
- ClearCharTasks(GetPlayerPed())
- end
- end
- end
- end)
- AddEventHandler('911callEMS', function(senderid)
- CreateThread(function()
- local sender = GetPlayerByServerId(tonumber(senderid))
- senderPosEMS = table.pack(GetCharCoordinates(sender.ped, _f, _f, _f))
- if(IsCharModel(GetPlayerPed(), GetHashKey("M_Y_PMEDIC", _r))) then
- emsCallQ=1
- end
- end)
- end)
- CreateThread(function()
- while true do
- Wait(0)
- if(emsCallQ==1) then
- ShowText("~b~911 call in progress. Press ~g~E ~b~to accept it or ~r~N ~b~to deny it", 500)
- if IsGameKeyboardKeyJustPressed(18) then
- callerBlipEMS = AddBlipForCoord(senderPosEMS[1], senderPosEMS[2], senderPosEMS[3], _i)
- ChangeBlipSprite(callerBlipEMS, 33)
- ChangeBlipColour(callerBlipEMS, 1)
- SetBlipAsShortRange(callerBlipEMS, true)
- SetRoute(callerBlipEMS, true)
- EnableGpsInVehicle(GetCarCharIsUsing(GetPlayerPed(), _i), true)
- callPos=2
- ShowText("~b~Call accepted. Proceed to destination.", 10000)
- emsCallQ=0
- elseif IsGameKeyboardKeyJustPressed(49) then
- emsCallQ=0
- ShowText("~r~Call denied.", 7000)
- end
- end
- end
- end)
- AddEventHandler('911callFire', function(senderid)
- CreateThread(function()
- local sender = GetPlayerByServerId(tonumber(senderid))
- senderPosFire = table.pack(GetCharCoordinates(sender.ped, _f, _f, _f))
- if(IsCharModel(GetPlayerPed(), GetHashKey("M_Y_FIREMAN", _r)) or IsCharModel(GetPlayerPed(), GetHashKey("M_M_FIRECHIEF", _r))) then
- fireCallQ=1
- end
- end)
- end)
- CreateThread(function()
- while true do
- Wait(0)
- if(fireCallQ==1) then
- ShowText("~b~911 call in progress. Press ~g~E ~b~to accept it or ~r~N ~b~to deny it", 500)
- if IsGameKeyboardKeyJustPressed(18) then
- callerBlipFire = AddBlipForCoord(senderPosFire[1], senderPosFire[2], senderPosFire[3], _i)
- ChangeBlipSprite(callerBlipFire, 33)
- ChangeBlipColour(callerBlipFire, 6)
- SetBlipAsShortRange(callerBlipFire, true)
- SetRoute(callerBlipFire, true)
- EnableGpsInVehicle(GetCarCharIsUsing(GetPlayerPed(), _i), true)
- callPos=3
- ShowText("~b~Call accepted. Proceed to destination.", 10000)
- fireCallQ=0
- elseif IsGameKeyboardKeyJustPressed(49) then
- fireCallQ=0
- ShowText("~r~Call denied.", 7000)
- end
- end
- end
- end)
- AddEventHandler('trigger911CallPolice', function()
- CreateThread(function()
- TriggerServerEvent('911callService', 1)
- end)
- end)
- AddEventHandler('trigger911CallEMS', function()
- CreateThread(function()
- TriggerServerEvent('911callService', 2)
- end)
- end)
- AddEventHandler('trigger911CallFire', function()
- CreateThread(function()
- TriggerServerEvent('911callService', 3)
- end)
- end)
- --[[CreateThread(function()
- while true do
- Wait(0)
- if(callPos==1) then
- if(IsPlayerNearCoords(callerBlipP[1], callerBlipP[2], callerBlipP[3], 10.0)) then
- ShowText("~r~You arrived to the scene!", 7000)
- Wait(7000)
- RemoveBlip(callerBlipP)
- callPos=0
- end
- end
- end
- end)
- CreateThread(function()
- while true do
- Wait(0)
- if(callPos==2) then
- if(IsPlayerNearCoords(callerBlipEMS[1], callerBlipEMS[2], callerBlipEMS[3], 10.0)) then
- ShowText("~r~You arrived to the scene!", 7000)
- Wait(7000)
- RemoveBlip(callerBlipEMS)
- callPos=0
- end
- end
- end
- end)
- CreateThread(function()
- while true do
- Wait(0)
- if(callPos==3) then
- if(IsPlayerNearCoords(callerBlipFire[1], callerBlipFire[2], callerBlipFire[3], 10.0)) then
- ShowText("~r~You arrived to the scene!", 7000)
- Wait(7000)
- RemoveBlip(callerBlipFire)
- callPos=0
- end
- end
- end
- end)]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement