Jump to content

Problem with 3DText


xeon17

Recommended Posts

Posted

I'm trying to add 3DText on a ped , but there is a problem with the export function.

My code:

--Ped 
  
  
PedPolice = createPed (280,1555.34094, -1675.74585, 16.19531) 
PedPolice2 = createPed (284,1543.82703, -1631.83557, 13.38281) 
setElementFrozen(PedPolice,true) 
setPedAnimation( PedPolice, "PED", "IDLE_CHAT") 
setElementRotation(PedPolice,0,0,450)  
setElementRotation(PedPolice2,0,0,450)  
addEventHandler ( "onClientPedDamage",PedPolice, 
function  ( ) 
    cancelEvent () 
end) 
  
addEventHandler ( "onClientPedDamage",PedPolice2, 
function  ( ) 
    cancelEvent () 
end) 
  
  
 -- Draw of Ped Text 
  
 addEventHandler( "onClientRender",root, 
   function( ) 
      local px, py, pz, tx, ty, tz, dist 
      px, py, pz = getCameraMatrix( ) 
         tx, ty, tz = getElementPosition( PedPolice ) 
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 ) 
         if dist < 30.0 then 
               local sx, sy, sz = getPedBonePosition( PedPolice, 5 ) 
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.5 ) 
               if x then -- getScreenFromWorldPosition returns false if the point isn't on screen 
               exports["(GW)3DText"]:create3DTextLabel("LEI",0xAARRGGBB,x-100,y,x,y,15,0,default-bold,1) 
               end 
         end 
      end 
) 
  

Error line:

               exports["(GW)3DText"]:create3DTextLabel("LEI",0xAARRGGBB,x-100,y,x,y,15,0,default-bold,1) 

Error:

Loading of script failed (GW)LEI/client.lua:40 malfored number near 0xAARRGGBB 

The resource i'm using the export function : viewtopic.php?f=108&t=79794

The code worked good with dxDrawText

dxDrawText( "LEI", x-100, y, x, y, tocolor(0, 0, 255), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" ) 

Hope someone can help me.

Posted
"0xAARRGGBB" is not a color , it's a default form of hex color's. AA = alpha , RR = red , GG = green , BB = blue.

So if you want white color you use : 0xFFFFFFFF , or tocolor(255,255,255,255)

For more hex color codes check this out : http://www.color-hex.com/

Thank you man , the error is fixed now but the problem is nothing happen now there isn't text on the ped..

Posted

Forgot to write , there is a error in debugscript3

exports["(GW)3DText"]:create3DTextLabel("LEI",0x0000FF,x-100,y,x,y,15,0,default-bold,1) 

debugscript3 : http://imgur.com/Wwna94Q.png

without the argument ''defualt-bold'' there isn't a error in debugscript 3 , but there isn't text on the ped too.

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...