[HELP Request] Trigger Event with a Marker

So i am working on that part of a Script where you enter the Marker, Press “E” and that Trigger the TrafficAlert Event. I have no Error showing up in F8 or in the Server Console, any help how i can get this to work?

https://pastebin.com/NvAQ4fLv

You can’t trigger a client event like that in a client script. You would need to change it to TriggerEvent(“TrafficAlert”) or TriggerServerEvent(“TrafficAlert”) if you’re triggering a server event.

Thanks man, i made it to Work with TriggerEvent(“TrafficAlert”)! <3 Its just broke my head the last Day

No problem, happy to help :wink:

Ah shit, there is still something i forgot.

Im stucking with Showing the Notification when entering the Marker.
Would be nice if you can help me with the last thing! <3

I won’t test it myself, just say the wrong line if there’s one, how it should work and community will help.
Anyway I’d change it like this and test it:

Server Part

RegisterServerEvent("TrafficAlertS")
AddEventHandler('TrafficAlertS', function(inputText)
    TriggerClientEvent('DisplayTrafficAlert', -1, inputText)
end)

Client Part

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        DrawMarker(1, coords.x, coords.y, coords.z, 0, 0, 0, 0, 0, 0, size, size, height, 0, 155, 255, 155, 0, 0, 2, 0, 0, 0, 0)
        if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), coords.x, coords.y, coords.z, true) < size then
            CurrentActionMsg  = ('press_menu')
            if (IsControlJustPressed(1, Key)) then
                TriggerEvent("TrafficAlertC")
            end
        end
    end
end)


RegisterNetEvent("TrafficAlertC")
AddEventHandler("TrafficAlertC",function()
	DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 20)
	local input = true
	Citizen.CreateThread(function()
		while input do
			if input == true then
				HideHudAndRadarThisFrame()
				if UpdateOnscreenKeyboard() == 3 then
					input = false
				elseif UpdateOnscreenKeyboard() == 1 then
					local inputText = GetOnscreenKeyboardResult()
					if string.len(inputText) > 0 then
						TriggerServerEvent('TrafficAlertS', inputText)
						input = false
					else
						DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 20)
					end
				elseif UpdateOnscreenKeyboard() == 2 then
					input = false
				end
			end
			 Citizen.Wait(0)
		 end			
	end)
end)

You also need to add the rest of the code

Okay so this is all what works with the Notification: https://pastebin.com/00fFFZLy