Hi, I’m a little bit stuck here and i wanted to know if someone knows how i can resolve this problem, so i used this resource to force an automatic message (The person pulls his phone out) when the player uses his phone (by clicking on ~/²) AND by using the animation used when you pull out the phone. This works perfectly but when i try to put the phone away (by clicking on ~/²) , the same message from earlier appears
here is the script i’m using :
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = PlayerPedId()
if IsEntityPlayingAnim(playerPed, 'cellphone_text_out', 'idle', 3) ~= 1 and IsControlJustPressed(0,243) then
TriggerServerEvent('3dme:shareDisplay3', text)
end
end
end)
what i want to do is use a specific message when the person pulls her phone out and another message when she “ranges” it.
Hi! I messed with the script a bit and tried to display the 3d text like seen in the gif, but the rectangle is moving around with the player. Do you know what I can do, that the rectangle doesn’t move around like that?
The trigger needs to be on the server side. For example :
RegisterServerEvent('trunkOpened')
AddEventHandler('trunkOpened', function()
local Source = source
local text = "* the person opened the trunk of the car *"
TriggerClientEvent('3dme:shareDisplay', -1, text, Source)
end)
Hey Elio, sorry for the late response. This is the code I used:
local function DrawText3D(coords, text, color)
local camCoords = GetGameplayCamCoord()
local dist = #(coords - camCoords)
local onScreen, _x, _y = World3dToScreen2d(coords.x, coords.y, coords.z)
-- Experimental math to scale the text down
local scale = 185 / (GetGameplayCamFov() * dist)
if onScreen then
-- Format the text
SetTextProportional(1)
SetTextColour(255, 255, 255, 250)
SetTextEntry("STRING")
SetTextScale(0.0, defaultScale * scale)
SetTextDropshadow(0, 0, 0, 0, 0)
SetTextDropShadow()
SetTextCentre(1)
SetTextFont(6)
AddTextComponentString(text)
-- Diplay the text
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
SetDrawOrigin(coords, 0)
EndTextCommandDisplayText(0.0, 0.0)
ClearDrawOrigin()
local factor = (string.len(text)) / 280
DrawRect(_x, _y + 0.0125, (0.035 + factor * scale), 0.025 * scale, 55, 55, 55, 150)
end
end
Any way to do that when you pick up gun and it says:
Picks out gun.
And how to add it on esx_policjob
that when you arrest it says:
Arrest’s uncuff’s civilian.
Any help?
@Elio Is there any way to get the /me to also go in the chat (local) so just people around you can see it in the chat as well as above your head so if you miss what someone says you can scroll up in the chat and see it?
@Elio im using 2.2 i believe and it pops up in the chat as well as above my head, but it goes above every single persons head in the server when i do it