Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PlayerData = {}
- ESX = nil
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- end)
- RegisterNetEvent('esx:playerLoaded')
- AddEventHandler('esx:playerLoaded', function(xPlayer)
- PlayerData = xPlayer
- end)
- RegisterNetEvent('esx:setJob')
- AddEventHandler('esx:setJob', function(job)
- PlayerData.job = job
- end)
- --- Ne Pas Editer!!!
- local holstered = true
- -- ANIMATIONS DE LA RADIO --
- Citizen.CreateThread(function()
- while true do
- Wait( 0 )
- local _source = source
- local ped = PlayerPedId()
- if PlayerData.job ~= nil and PlayerData.job.name == 'ambulance' and not IsEntityDead( ped ) then
- -- if DoesEntityExist( ped ) and not IsEntityDead( ped ) and CheckSkin(ped) then
- if not IsPauseMenuActive() then
- loadAnimDict( "random@arrests" )
- if IsControlJustReleased( 0, 246 ) then -- INPUT_CHARACTER_WHEEL (LEFT ALT)
- TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 10, "off", 0.1)
- ClearPedTasks(ped)
- SetEnableHandcuffs(ped, false)
- else
- if IsControlJustPressed( 0, 246 ) and not IsPlayerFreeAiming(PlayerId()) then -- INPUT_CHARACTER_WHEEL (LEFT ALT)
- TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 10, "on", 0.1)
- TaskPlayAnim(ped, "random@arrests", "generic_radio_enter", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0 )
- SetEnableHandcuffs(ped, true)
- elseif IsControlJustPressed( 0, 246 ) and IsPlayerFreeAiming(PlayerId()) then -- INPUT_CHARACTER_WHEEL (LEFT ALT)
- TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 10, "on", 0.1)
- TaskPlayAnim(ped, "random@arrests", "radio_chatter", 8.0, 2.0, -1, 50, 2.0, 0, 0, 0 )
- SetEnableHandcuffs(ped, true)
- end
- if IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests", "generic_radio_enter", 3) then
- DisableActions(ped)
- elseif IsEntityPlayingAnim(GetPlayerPed(PlayerId()), "random@arrests", "radio_chatter", 3) then
- DisableActions(ped)
- end
- end
- end
- end
- end
- end )
- -- DO NOT REMOVE THESE! --
- function CheckSkin(ped)
- for i = 1, #skins do
- if GetHashKey(skins[i]) == GetEntityModel(ped) then
- return true
- end
- end
- return false
- end
- function CheckWeapon(ped)
- for i = 1, #weapons do
- if GetHashKey(weapons[i]) == GetSelectedPedWeapon(ped) then
- return true
- end
- end
- return false
- end
- function DisableActions(ped)
- DisableControlAction(1, 140, true)
- DisableControlAction(1, 141, true)
- DisableControlAction(1, 142, true)
- DisableControlAction(1, 37, true) -- Disables INPUT_SELECT_WEAPON (TAB)
- DisablePlayerFiring(ped, true) -- Disable weapon firing
- end
- function loadAnimDict( dict )
- while ( not HasAnimDictLoaded( dict ) ) do
- RequestAnimDict( dict )
- Citizen.Wait( 0 )
- end
- end
- RegisterNetEvent('InteractSound_CL:PlayWithinDistance')
- AddEventHandler('InteractSound_CL:PlayWithinDistance', function(playerNetId, maxDistance, soundFile, soundVolume)
- local lCoords = GetEntityCoords(localVehId, false)
- local eCoords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(playerNetId)))
- local distIs = Vdist(lCoords.x, lCoords.y, lCoords.z, eCoords.x, eCoords.y, eCoords.z)
- local farSound
- if(distIs < maxDistance) then
- SendNUIMessage({
- transactionType = 'playSound',
- transactionFile = soundFile,
- transactionVolume = soundVolume
- })
- elseif distIs >= maxDistance and distIs < 15.0 then
- SendNUIMessage({
- transactionType = 'playSound',
- transactionFile = soundFile,
- transactionVolume = 0.15
- })
- elseif distIs >= 15.0 and distIs < 30.0 then
- SendNUIMessage({
- transactionType = 'playSound',
- transactionFile = soundFile,
- transactionVolume = 0.10
- })
- elseif distIs >= 30.0 and distIs < 50.0 then
- SendNUIMessage({
- transactionType = 'playSound',
- transactionFile = soundFile,
- transactionVolume = 0.05
- })
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement