[Request] script HUD spawnpoint


#1

i wanna config my server ,wanna change spawnlocation ,i know that i must change in map.lua ,but is not the probleme, i wanna a script that show y,x,z number for change spawnpoint
tita
thank


#2

put this in your script:

showxyz = 0
function drawTxt(x,y ,width,height,scale, text, r,g,b,a)
    SetTextFont(0)
    SetTextProportional(0)
    SetTextScale(scale, scale)
    SetTextColour(r, g, b, a)
    SetTextDropShadow(0, 0, 0, 0,255)
    SetTextEdge(1, 0, 0, 0, 255)
    SetTextDropShadow()
    SetTextOutline()
    SetTextEntry("STRING")
    AddTextComponentString(text)
    DrawText(x - width/2, y - height/2 + 0.005)
end

function ShowXYZ()
        local pos = GetEntityCoords(GetPlayerPed(-1))
	local pos_str = string.format("~b~x:~w~ %f~n~~b~y:~w~ %f~n~~b~z:~w~ %f",pos['x'], pos['y'], pos['z'])
	drawTxt(0.87,0.06,0.058,-1.55, 0.40,pos_str,255,255,255,255)
	DrawRect(0.91,0.915,0.175,0.16,0,0,0,150)
end

Citizen.CreateThread(function()
	while true do
		Wait(0)
                 if showxyz == 1 then
                             ShowXYZ()
                end
                if IsControlJustPressed(1, 188) then
		             if showxyz == 0 then showxyz = 1 elseif showxyz == 1 then showxyz  = 0 end
	                    PlaySound(-1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 0, 0, 1)
               end
        end
end)

This code will shows you coords in right bottom side of screen if you press key UP (same as phone up key)