I’m getting this error, anyone knows what i’m doing wrong?

SetTextFont(4)
SetTextProportional(1)
SetTextScale(0.45, 0.45)
SetTextColour(185, 185, 185, 255)
SetTextDropShadow(0, 0, 0, 0, 255)
SetTextEdge(1, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
BeginTextCommandDisplayText(‘STRING’)
AddTextComponentSubstringPlayerName(‘Press ~b~ [F]~s~ to summon an AI’)
EndTextCommandDisplayText(0.175, 0.805)

Use a resource manifest version.

Thank you, the error is gone, But text doesn’t show up

Whats the rest of the script look like

function StartAIDistressSignal()
Citizen.CreateThread(function()
local timer = 900
while timer > 0 and IsDead do
Citizen.Wait(2)
timer = timer - 30

  	SetTextFont(4)
  	SetTextProportional(1)
  	SetTextScale(0.45, 0.45)
  	SetTextColour(185, 185, 185, 255)
  	SetTextDropShadow(0, 0, 0, 0, 255)
  	SetTextEdge(1, 0, 0, 0, 255)
  	SetTextDropShadow()
  	SetTextOutline()
  	BeginTextCommandDisplayText('STRING')
  	AddTextComponentSubstringPlayerName(‘Press ~b~ [F]~s~ to summon an AI’)
  	EndTextCommandDisplayText(0.175, 0.805)

  	if IsControlPressed(0, config.distressCallKey) then
  		SummonAI()
  		break
  	end
  end

end)
end

What’s it supposed to do? Draw text over a player if they are dead or draw it somewhere on their screen?

If I understand the script correctly I would do something like this. I haven’t tested this because I’m at work, coincidentally also why this took so long to respond to.

Citizen.CreateThread(function StartAIDistressSignal()
local timer = 900
	while timer > 0 and IsDead do
		Citizen.Wait(100)
			timer = timer - 30

			DrawText3D(x, y, z, "Press ~b~[F]~s~ to summon as AI") -- In this instance you'd wanna draw it over the ped I assume. So get the ped coordinates. or is this happening at a specific location? 

	  if IsControlPressed(0, config.distressCallKey) then -- Might as well put the key number in if on the draw text it says press [F]( I think its 144).  Unless you change the text to print 'config.distressCallKey'
	  		SummonAI()
	  		break
	  	end
	  end
end)


function DrawText3D(x,y,z, text) --Courtesy of Havoc https://forum.cfx.re/t/drawtext-position-fix/53524/10
    local onScreen,_x,_y= World3dToScreen2d(x,y,z)
		
if onScreen then
	BeginTextCommandDisplayText("STRING")
        
	SetTextScale(0.0, 0.55)
    SetTextFont(0)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 255)
    SetTextDropshadow(0, 0, 0, 0, 255)
    SetTextEdge(2, 0, 0, 0, 150)
    SetTextDropShadow()
    SetTextOutline()
        
    SetTextCentre(1)
    AddTextComponentString(text)
    EndTextCommandDisplayText(_x,_y)
    end
end
1 Like

When you die it’s suposed to print a text on the “dead” client’s screen, Like “Press F to summon AI” And then the Ai summons and goes to its location and revives the player :slight_smile: But this code ya wrote, is it in screen or on world? Thanks for the long answer btw

Also i figured out the problem now, i fucked up by the time the text only shows 1 milii sec :smiley:

Glad you figured it out.