Jump to content

Custom Blip and dxText


Recommended Posts

functions:

dxDrawText 
getScreenFromWorldPosition 

example:

local x, y, z = getElementPosition(theMarker) 
local sx, sy = getScreenFromWorldPosition(x, y, z+3) 
dxDrawText('MARKER', x, y, --rest of the arguments 

Link to comment
function cadirkur (thePlayer) 
local x,y,z = getElementPosition(thePlayer) 
local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) 
local isim = getPlayerName(thePlayer) 
createObject(1678,x,y+3,z) 
dxDrawText (isim,sx,sy) 
end 
addCommandHandler("kur",cadirkur) 

I have got error at line 6.

Link to comment

What the error says??

EDIT: it is client i forgot here:

function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) 
local isim = getPlayerName(getLocalPlayer()) 
createObject(1678,x,y+3,z) 
dxDrawText (isim,sx,sy) 
end 
addCommandHandler("kur",cadirkur) 

and the text won't appear beacause it needs to be onClientRender.

Link to comment
function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
createObject(1678,x,y+3,z) 
triggerEvent("onDX",getRootElement()) 
end 
addCommandHandler("kur",cadirkur) 
  
function Dx() 
 x,y,z = getElementPosition(getLocalPlayer()) 
local isim = getPlayerName(getLocalPlayer()) 
local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) 
dxDrawText (isim,sx,sy) 
end 
addEvent ("onDX",true) 

Is this works?

Link to comment

No,

function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
createObject(1678,x,y+3,z) 
addEventHandler('onClientRender', root, Dx) 
end 
addCommandHandler("kur",cadirkur) 
  
function Dx() 
 x,y,z = getElementPosition(getLocalPlayer()) 
local isim = getPlayerName(getLocalPlayer()) 
local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) 
dxDrawText (isim,sx,sy) 
end 

Link to comment
function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
createObject(1678,x,y+3,z) 
addEventHandler('onClientRender', root, Dx) 
end 
addCommandHandler("kur",cadirkur) 
  
function Dx() 
local x,y,z = getElementPosition(getLocalPlayer()) 
local isim = getPlayerName(getLocalPlayer()) 
local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) 
dxDrawText (isim,sx,sy) 
end 

Link to comment
function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
createObject(1678,x,y+3,z) 
addEventHandler('onClientRender', root, Dx) 
end 
addCommandHandler("kur",cadirkur) 
  
function Dx() 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    local isim = getPlayerName(getLocalPlayer()) 
    local sx,sy = getScreenFromWorldPosition(x,y,z+1) 
    dxDrawText (isim,sx,sy-1) 
end 

Link to comment

When i do like tihs

function cadirkur () 
local x,y,z = getElementPosition(getLocalPlayer()) 
cadir = createObject(1678,x,y+3,z) 
addEventHandler('onClientRender', root, Dx) 
end 
addCommandHandler("kur",cadirkur) 
  
function Dx() 
    local x,y,z = getElementPosition(cadir) 
    local isim = getPlayerName(getLocalPlayer()) 
    local sx,sy = getScreenFromWorldPosition(x,y,z+1) 
    dxDrawText (isim,sx,sy-1) 
end 

I get error at sy

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