Jump to content

Help me whit dxdrewtext


ProX~

Recommended Posts

I wish someone help me fix the error that has this script because it does not work

gMe = getLocalPlayer() 
gMeCar = getPedOccupiedVehicle(gMe) 
gRoot = getRootElement() 
screenWidth, screenHeight = guiGetScreenSize() 
function Texts () 
    local XL2, YL2 = getScreenFromWorldPosition ( 2100, 3902.2028808594, 68.285171508789) 
    if XL2 and YL2 then 
        x,y,z = getElementPosition(gMe) 
        local distance = getDistanceBetweenPoints2D ( x, y, 2100, 3902.2028808594) 
        if distance > 130 or distance < 10 then return end 
        local size = distance/400 
        dxDrawText ( "PROX", XL2, YL2,XL2, YL2, tocolor ( 0, 0, 0, 128 ), 1/size-3, "bankgothic", "center", "center" ) 
        dxDrawText ( "PROX", XL2, YL2,XL2, YL2, tocolor ( 0, 35,128, 255 ), 1/size-3.1, "bankgothic", "center", "center"  ) 
    end 
end 

If I could fix that error and they are grateful

Also, someone could make a script of dxdrewtext with these coordinates

x: 3313.59765625 
y:-2451.5554199219 
z:47.380950927734 

The text, font, size and color are on me

Grettings! :D

Link to comment

I'm not exactly sure what you want your script to do, but I think you want it to do this...fill in your settings, tweak the color's etc and execute it on your server. 8)

  
-- *************************** 
-- * Set your options below  * 
-- *************************** 
local message "Type your message here " 
local pointX, pointY, pointZ = 3313.59765625, -2451.5554199219, 47.380950927734 
  
local font = "bankgothic"              --  font to show 
  
local fontSize = 2                         --font size to show 
  
local maxViewRange= 10              --Max view range for the display 
  
local rectangleRed = 0 
local rectangleBlue = 0 
local rectangleGreen = 0 
local rectangleAlpha = 200 
  
local textRed = 255 
local textBlue = 255 
local textGreen = 255 
local textAlpha = 255 
  
-- Code below 
local screenWidth, screenHeight = guiGetScreenSize() 
addEventHandler("onClientRender", getRootElement(), 
    function() 
        local sx,sy = getScreenFromWorldPosition (pointX,pointY,pointZ) 
        local cameraX,cameraY,cameraZ = getCameraMatrix() 
        if sx then 
            if getDistanceBetweenPoints3D(cameraX,cameraY,cameraZ,pointX,pointY,pointZ) <= maxViewRange then 
                dxDrawRectangle ( sx - 100, sy + 14.5, screenWidth/7.5 + 200, screenHeight/30 + 20 ,tocolor ( rectangleRed, rectangleGreen, rectangleBlue, rectangleAlpha ) ) 
                dxDrawText(message, sx - 100, sy, screenWidth, screenHeight,tocolor ( textRed, textGreen, textBlue, textAlpha ), fontSize ,font) 
            end 
        end 
    end 
)  

:mrgreen: Tell me if it works ;D

The next time you need help please specify what you want your script to do and tell us what the debug says.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...