SkiZo Posted August 7, 2017 Share Posted August 7, 2017 (edited) So .. i'm trying to make table wich is create markers .. and put a description in the top of it .. like this #CLIENT SIDE markers = createMarker{ {1187,-1313,-13.5,"cylinder", 2, 0, 255, 255, 0}, --Hospital {2035,-1429,16.9,"cylinder", 2, 0, 255, 255, 0}, -- Hospital {-2192,-2291,30.6,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-2654,632,14.4,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-1505,2533,55.68,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-326,1063,19.7,"cylinder", 2, 0, 255, 255, 0}, --Hospital {1608,1838,10.8,"cylinder", 2, 0, 255, 255, 0} --Hospital } addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( markers ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText( "Free Vehicle", x, y+1.5, _, _, tocolor( 0, 255, 255, 255 ), 1, "default-bold-small", "center", "center" ) end end end ) AnyHelp ? by the way there is another script create markers .. this only create them with 0 alpha . Thanks #EDIT: Line 13 local pedX, pedY, pedZ = getElementPosition [ #markers ] But nothing Edited August 7, 2017 by Legend<3 Link to comment
kikos500 Posted August 7, 2017 Share Posted August 7, 2017 local markers = { {1187,-1313,-13.5,"cylinder", 2, 0, 255, 255, 0}, --Hospital {2035,-1429,16.9,"cylinder", 2, 0, 255, 255, 0}, -- Hospital {-2192,-2291,30.6,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-2654,632,14.4,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-1505,2533,55.68,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-326,1063,19.7,"cylinder", 2, 0, 255, 255, 0}, --Hospital {1608,1838,10.8,"cylinder", 2, 0, 255, 255, 0} --Hospital } function create() -- create a function to createMarkers on resource start for _, marker in pairs(markers) do -- looping through the table of markers createMarker(unpack(marker)) --[[ if this doesn't work then try this createMarker(marker[1], marker[2], marker[3], marker[4], marker[5], marker[6], marker[7], marker[8], marker[9]) ]] end end addEventHandler("onClientResourceStart", resourceRoot, create) -- attaching the event your code will never work i advise you to use debugscript 3 to debug your scripts anyway i don't fully understand what you want to do but i fixed the creating markers part Link to comment
SkiZo Posted August 7, 2017 Author Share Posted August 7, 2017 i don't know about that .. but read this maybe you will understand what i mean ... --#Client --#i found this in community local alpha = 0 local r, g, b = 255, 255, 255 local size = 1.5 local typem = "cylinder" local posx, posy, posz = 1976.0625, -1251.630859375, 22.8203125 local entradaB = createMarker (posx, posy, posz, typem, size, r, g, b, alpha) addEventHandler( "onClientRender", root, function ( ) local x, y, z = getElementPosition( entradaB ) local Mx, My, Mz = getCameraMatrix( ) if ( getDistanceBetweenPoints3D( x, y, z, Mx, My, Mz ) <= 30 ) then local WorldPositionX, WorldPositionY = getScreenFromWorldPosition( x, y, z +1, 0.07 ) if ( WorldPositionX and WorldPositionY ) then dxDrawText("Entrada\nBase S.W.A.T.", WorldPositionX - 1, WorldPositionY - 1, WorldPositionX - 1, WorldPositionY - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Entrada\nBase S.W.A.T.", WorldPositionX + 1, WorldPositionY - 1, WorldPositionX + 1, WorldPositionY - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Entrada\nBase S.W.A.T.", WorldPositionX - 1, WorldPositionY + 1, WorldPositionX - 1, WorldPositionY + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Entrada\nBase S.W.A.T.", WorldPositionX + 1, WorldPositionY + 1, WorldPositionX + 1, WorldPositionY + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("Entrada\nBase S.W.A.T.", WorldPositionX, WorldPositionY, WorldPositionX, WorldPositionY, tocolor(255, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end end end ) This will create something like this .. Spoiler So .. i'm trying to put the dx Text in the table of markers ... damn i have bad english sorry Link to comment
SkiZo Posted August 7, 2017 Author Share Posted August 7, 2017 9 hours ago, kikos500 said: local markers = { {1187,-1313,-13.5,"cylinder", 2, 0, 255, 255, 0}, --Hospital {2035,-1429,16.9,"cylinder", 2, 0, 255, 255, 0}, -- Hospital {-2192,-2291,30.6,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-2654,632,14.4,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-1505,2533,55.68,"cylinder", 2, 0, 255, 255, 0}, --Hospital {-326,1063,19.7,"cylinder", 2, 0, 255, 255, 0}, --Hospital {1608,1838,10.8,"cylinder", 2, 0, 255, 255, 0} --Hospital } function create() -- create a function to createMarkers on resource start for _, marker in pairs(markers) do -- looping through the table of markers createMarker(unpack(marker)) --[[ if this doesn't work then try this createMarker(marker[1], marker[2], marker[3], marker[4], marker[5], marker[6], marker[7], marker[8], marker[9]) ]] end end addEventHandler("onClientResourceStart", resourceRoot, create) -- attaching the event your code will never work i advise you to use debugscript 3 to debug your scripts anyway i don't fully understand what you want to do but i fixed the creating markers part Did not work ( the both of your codes but i fix it ) markers = { {1177.26, -1324.92, 14.06 }, --Hospital {2029.25, -1419.17, 16.99 }, -- Hospital {-320.21, 1055.96, 20 }, --Hospital {-2654,632,14.4 }, --Hospital {-2644.37, 633.05, 14.45 }, --Hospital {-2201.14, -2292.66, 30.63 }, --Hospital {-1514.47, 2527.25, 55.74 } --Hospital } for i, k in pairs(markers) do HospitalHeal = createMarker(k[1], k[2], k[3],"cylinder", 2, 255, 255, 0,250) end 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