help ricx

mail@pastecode.io avatar
unknown
lua
3 years ago
2.9 kB
14
Indexable
Never
back = true
Notified = false
dst = nil
local pigeon = nil
message = nil
local blip

RegisterNetEvent('FRP:PEAGLE:ReceiveMenssage')
AddEventHandler('FRP:PEAGLE:ReceiveMenssage', function(PlayerCoords, text) -- FUNCTION WHO ARRE TRIGGERED BY THE RECEIVER OF PIGEON
        pigeon = CreatePed("A_C_Pigeon", PlayerCoords, 92.0, true, true, true, true) -- SPAWN PIGEON AT THE SENDER POSITION OF PIGEON (where pigeon start to fly)
        Citizen.InvokeNative(0x283978A15512B2FE, pigeon, true)
        message = text
        ClearPedTasks(pigeon)
        ClearPedSecondaryTask(pigeon)
        ClearPedTasksImmediately(pigeon)
        SetPedFleeAttributes(pigeon, 0, 0)
        TaskWanderStandard(pigeon, 1, 0)
        TaskSetBlockingOfNonTemporaryEvents(pigeon, 1)
        SetEntityAsMissionEntity(pigeon)        
        Wait(2000)        
        local playc = GetEntityCoords(PlayerPedId())
        TaskFlyToCoord(pigeon, 0, playc.x, playc.y, playc.z+30, 1, 0) -- ASK TO PIGEON TO FLY TO THE RECEIVER
        Citizen.InvokeNative(0xA5C38736C426FCB8, pigeon, true)

        local blipname = "Pigeon voyageur"
        local bliphash = 587827268
        blip = Citizen.InvokeNative(0x23f74c2fda6e7c61, bliphash, pigeon) -- BLIPADDFORENTITY
        SetBlipScale(blip, 0.5)

       


        while true do
            Citizen.Wait(1)
                local player = PlayerPedId()
                local coords = GetEntityCoords(player)
                local ec = GetEntityCoords(pigeon)
                local myV = vector3(coords.x, coords.y, coords.z)
                dst = #(vector3(ec.x, ec.y, ec.z) - myV)
                local ed = coords.x, coords.y, coords.z
                local playc = GetEntityCoords(PlayerPedId())

                if back then
                    TaskFlyToCoord(pigeon, 0, playc.x, playc.y, playc.z+30, 1, 0)
                end                
              
                if dst < 25 then  
                    if not Notified then
                        TriggerEvent("redemrp_notification:start", 'Vous avez reçu un pigeon voyageur, attendez que le pigeon s approche de vous.' , 5, "success")
                        Notified = true 
                        back = false                   
                    end
                    -- local IsPedAir = IsEntityInAir(pigeon, 1)
              
                    -- if IsControlJustPressed(0, 0xE8342FF2) then -- Hold ALT
                    --     print('pressed')
                    --    -- TaskWhistleAnim(PlayerPedId(), -433953410, 1971704925)                        
                    --     back = false
                    --     Wait(15000)
                    --     TaskFlyToCoord(pigeon, 0, playc.x, playc.y, playc.z, 1, 0)                          
                    -- end
                end
        end
    end
)