1LoL1 Posted January 30, 2016 Share Posted January 30, 2016 (edited) Hello, i have this script why i have this error? and how i can change color of dxDrawText to yellow? Please can anyone help me? Warnings: WARNING: Bad argument @ 'dxDrawText' [Expected vector2 at argument2, got boolean] WARNING: Bad argument @ 'dxDrawText' [Expected vector2 at argument2, got boolean] [DUP x264] addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local test = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if test < 40 then dxDrawText("TEXT", X, Y) end end end end) Edited January 30, 2016 by Guest Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local test = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if test < 40 then dxDrawText("TEXT",353,675,671,713,tocolor(255,255,0,255),1.10,"arial","left","top",false,false,false) end end end end) Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local test = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if test < 40 then dxDrawText("TEXT",353,675,671,713,tocolor(255,255,0,255),1.10,"arial","left","top",false,false,false) end end end end) Not work i don't see "TEXT" My code work normally but have 2 warning and i need change color to yellow. Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 Yeah now I got you, try that addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local test = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if test < 40 then dxDrawText("TEXT", X, Y, X, Y,tocolor(255,255,0,255),1.5,"bankgothic", "center")) end end end end) Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 Yeah now I got you, try that addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local test = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if test < 40 then dxDrawText("TEXT", X, Y, X, Y,tocolor(255,255,0,255),1.5,"bankgothic", "center")) end end end end) Thanks working. But i again see warning. Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 Thanks working. But i again see warning. Which warning? post it here Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 Thanks working. But i again see warning. Which warning? post it here Sorry warnings* WARNING: Bad argument @ 'dxDrawText' [Expected vector2 at argument2, got boolean] WARNING: Bad argument @ 'dxDrawText' [Expected vector2 at argument2, got boolean] [DUP x264] Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 It should works correctly, try it and tell me the result addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local dist = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if dist < 40 then if X and Y then dxDrawText("TEXT", X, Y, X, Y, tocolor(255,255,0,255),1.5, "bankgothic", "center") end end end end end) Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 It should works correctly, try it and tell me the result addEventHandler("onClientRender", getRootElement(), function () for k,veh in pairs(getElementsByType("vehicle")) do if isElementOnScreen(veh) then local x, y, z = getElementPosition(veh) local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local dist = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if dist < 40 then if X and Y then dxDrawText("TEXT", X, Y, X, Y, tocolor(255,255,0,255),1.5, "bankgothic", "center") end end end end end) Thanks Working perfect!!!. Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 Thanks Working perfect!!!. You're welcome Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 One question. Is possible of this: to ? If yes here is code: addEventHandler("onClientRender", getRootElement(), function () local x = -2844.7275390625 local y = 1290.7978515625 local z = 7.1015625 local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if (distance < 10) then if (X and Y) then dxDrawText("Mechanic", X, Y - 100, X, Y,tocolor(255,255,255,255)) end end end) Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 Yes it's possible, you've to get the object's position and apply that on your code Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 Yes it's possible, you've to get the object's position and apply that on your code i tried but not work and this is the code. Object i have in the code in x, y, z. Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 Yes it's possible, you've to get the object's position and apply that on your code i tried but not work and this is the code. Object i have in the code in x, y, z. Code: addEventHandler("onClientRender", getRootElement(), function () local x = -2844.7275390625 local y = 1290.7978515625 local z = 7.1015625 local X, Y = getScreenFromWorldPosition(x,y,z) local px, py, pz = getElementPosition(getLocalPlayer()) local distance = getDistanceBetweenPoints3D(x,y,z,px,py,pz) if (distance < 10) then if (X and Y) then dxDrawText("Mechanic", X-30, Y-50, _, _,tocolor(255,255,255,255), 1, "default", "left", "top", false, false, false, false, false) end end end) Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 Try that, addEventHandler("onClientRender", getRootElement(), function () local x, y, z = -2844.7275390625,1290.7978515625,7.1015625 local mx, my, mz = getCameraMatrix() local distance = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) local X, Y = getScreenFromWorldPosition(x,y,z+1.1,0.05) if (distance < 10) then if (X and Y) then dxDrawText("Mechanic", X, Y, X, Y, tocolor(255,255,255,255), 1, "default", "center", "center", false, false, false, false, false) end end end ) Link to comment
1LoL1 Posted January 30, 2016 Author Share Posted January 30, 2016 Try that, addEventHandler("onClientRender", getRootElement(), function () local x, y, z = -2844.7275390625,1290.7978515625,7.1015625 local mx, my, mz = getCameraMatrix() local distance = getDistanceBetweenPoints3D(x,y,z,mx,my,mz) local X, Y = getScreenFromWorldPosition(x,y,z+1.1,0.05) if (distance < 10) then if (X and Y) then dxDrawText("Mechanic", X, Y, X, Y, tocolor(255,255,255,255), 1, "default", "center", "center", false, false, false, false, false) end end end ) This is what i need really thanks working now perfect!!!. Link to comment
KariiiM Posted January 30, 2016 Share Posted January 30, 2016 This is what i need really thanks working now perfect!!!. Glad to hear that. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now