Police Megaphone [whitout mp3 files]

Hi !
Here is a little sharing, which will help you create a megaphone for the police :slight_smile:
Default key (right shift)

Preview: Make the player character speak (npc quotes) - #7 by F.Schrader

Citizen.CreateThread(function()
    while true do
        timer = 1000
        local playerPed = PlayerPedId()
        if IsPedInAnyPoliceVehicle(playerPed) then
            timer = 0
            if IsControlJustPressed(0, 21) then
                local Skin= GetHashKey("mp_m_freemode_01")
                local playerVeh = GetVehiclePedIsIn(playerPed, false)
                local playerPosition = GetEntityCoords(playerPed)
                Citizen.Wait(10)
                RequestModel(Skin)
                while(not HasModelLoaded(Skin)) do
                    Citizen.Wait(10)
                end
                    Megaphone = CreatePed(26, Skin, playerPosition.x, playerPosition.y, playerPosition.z, 1, false, true)
                    SetEntityInvincible(Megaphone, true)
                    SetEntityVisible(Megaphone, false)
                    SetEntityCollision(Megaphone, false, false)
                    SetEntityCompletelyDisableCollision(Megaphone, true, true)
                    AttachEntityToEntity(Megaphone, playerVeh, 0, 0.27, 0.0, 0.0, 0.5, 0.5, 180, false, false, false, false, 2, false)
                    PlayPedAmbientSpeechWithVoiceNative(Megaphone, "NO_LOITERING_MEGAPHONE", "S_M_Y_COP_01_WHITE_FULL_01", "SPEECH_PARAMS_FORCE_SHOUTED", 6)
                    
                    --[[
                        "STOP_VEHICLE_CAR_MEGAPHONE"
                        "STOP_VEHICLE_BOAT_MEGAPHONE"

                        "CLEAR_AREA_PANIC_MEGAPHONE"
                        "CLEAR_AREA_MEGAPHONE"

                        "NO_LOITERING_MEGAPHONE"
                        "STOP_ON_FOOT_MEGAPHONE"
                        "STOP_ON_FOOT_CHOPPER_MEGAPHONE"
                        "STOP_VEHICLE_CAR_WARNING_MEGAPHONE"
                        "STOP_VEHICLE_GENERIC_MEGAPHONE"
                        "STOP_VEHICLE_GENERIC_WARNING_MEGAPHONE"
                        "COP_ARRIVAL_ANNOUNCE_MEGAPHONE"
                        "SHOT_AT_HELI_MEGAPHONE"
                        "SHOT_TYRE_CHOPPER_MEGAPHONE"
                        "LOST_SUSPECT_CHOPPER_MEGAPHONE"
                        "SPOT_SUSPECT_CHOPPER_MEGAPHONE"
                    ]]
                    

                    Wait(5000)
                    DeleteEntity(Megaphone)
            end
        end
        Citizen.Wait(timer)
    end
end)
12 Likes

nice , i got a menu but it was in mp3 files.
Thanks for sharing :heart:

2 Likes

I just modify the content, copy code again :slight_smile:

Was looking for something like this thanks you ! :grinning_face_with_smiling_eyes:

1 Like

You should’ve used a RegisterKeyMapping for this, but however, still cool, I like it! :slight_smile:

1 Like

Yeah, it’s because this code is my test code, i will embed it differently for me :slight_smile:

You have a menu for this? Could you share it?

how would you make this serverside

policemega.zip (902.7 KB)
There is howtouse.txt just created by me, make sure to follow that dm if more support is needed.

I didn’t know who is the owner of this and if he/she finds this then i gave all credits to him/her.

thanks