Flipi Posted August 26, 2013 Share Posted August 26, 2013 (edited) Hi, how to add or enable color codes in the names? Script: https://community.multitheftauto.com/in ... ls&id=1778 Screen: http://imageshack.us/a/img543/1527/f0ez.png Screen2: http://imageshack.us/a/img819/6788/9l93.png modelX, modelY, modelZ = 219.9765, 1822.8145, 6.533 -- minimap location showLegend = createColSphere ( modelX, modelY, modelZ, 13 ) --colshape for activating nametags function makeMapMarker (player) local r, g, b = getPlayerNametagColor ( player ) local themarker = createMarker ( modelX, modelY, modelZ, "cylinder", .05, r, g, b, 255 ) setElementData ( player, "Radar_marker", themarker, false ) end function ResourceStart(startedresource) if startedresource == getThisResource() then Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do makeMapMarker (v) end setTimer(Radar_check, 250, 0) end end addEventHandler( "onClientResourceStart", getRootElement(), ResourceStart ) function PlayerJoin ( ) makeMapMarker (source) end addEventHandler( "onClientPlayerJoin", getRootElement(), PlayerJoin) function PlayerQuit ( ) destroyElement( getElementData ( source, "Radar_marker" ) ) end addEventHandler( "onClientPlayerQuit", getRootElement(), PlayerQuit) function Radar_check() Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do if isElement(v) then x,y,z = getElementPosition ( v ) x = x / 1642.935378 y = y / 1642.935378 z = z / 1642.935378 local themarker = getElementData ( v, "Radar_marker" ) setElementPosition ( themarker, modelX-y, modelY+x, modelZ+z ) --Whack math is because west is north on 3d model end end end function ColShapeHit ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if not mapNamesHandler then mapNamesHandler = addEventHandler ( "onClientRender", root, ClientRender ) end end end addEventHandler("onClientColShapeHit",showLegend,ColShapeHit) function ColShapeLeave ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if mapNamesHandler then removeEventHandler ( "onClientRender", root, ClientRender ) mapNamesHandler = nil end end end addEventHandler("onClientColShapeLeave", showLegend, ColShapeLeave ) function ClientRender () if trackmode == 1 then local Radar_items = getElementsByType( "player" ) for k,v in pairs(Radar_items) do local r, g, b, a = getMarkerColor ( getElementData ( v, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( v, "Radar_marker" ) ) local zOffset = (k/20)+.3 local screenX, screenY = getScreenFromWorldPosition ( x, y, z + zOffset ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local name = getPlayerName ( v ) dxDrawText ( name, screenX, screenY, screenX, screenY, tocolor(r, g, b) ) dxDrawLine ( screenX, screenY+13, screenXX, screenYY, tocolor(r,g,b), 1 ) end end elseif trackmode == 2 then local randomalpha = math.random( 70, 200 ) setElementAlpha(holoped, randomalpha) local r, g, b, a = getMarkerColor ( getElementData ( trackedplayer, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( trackedplayer, "Radar_marker" ) ) local zOffset = .3 local screenX, screenY = getScreenFromWorldPosition ( modelX, modelY, modelZ+.4 ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local screenXXX, screenYYY = getScreenFromWorldPosition ( modelX, modelY, modelZ+1.5 ) if screenXXX ~= false then local name = getPlayerName (trackedplayer) dxDrawText ( name, screenXXX+40, screenYYY-15, screenX, screenY, tocolor(r, g, b) ) local hp = getElementHealth ( trackedplayer) roundedhp = math.round(hp) if trackedarmor ~= nil then dxDrawText ( "Vida: "..roundedhp, screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Armadura: "..trackedarmor, screenXXX+40, screenYYY+15, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Ubicacion: "..trackedlocation..", "..trackedcity, screenXXX+40, screenYYY+30, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Arma: "..trackedweapon, screenXXX+40, screenYYY+45, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Vehiculo: "..trackedvehicle, screenXXX+40, screenYYY+60, screenX, screenY, tocolor(r, g, b) ) else dxDrawText ( "Escaneando...", screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) end end dxDrawLine ( screenX, screenY, screenXX, screenYY, tocolor(r,g,b), 1 ) end end end trackedvehicle = nil trackerMarker = createMarker (modelX-7.5596, modelY+.022, modelZ-1.019, "cylinder", 1.5, 255, 255, 0, 40 ) tracker_Window = {} tracker_Button = {} tracker_Grid = {} tracker_Window[1] = guiCreateWindow(123,142,223,228,"Contro de Seguimiento",false) guiWindowSetSizable(tracker_Window[1],false) tracker_Player = guiCreateButton(0.0942,0.8114,0.3901,0.136,"Mirar Jugador",true,tracker_Window[1]) tracker_All = guiCreateButton(0.5022,0.8158,0.3901,0.1316,"Mirar Todos",true,tracker_Window[1]) tracker_Grid = guiCreateGridList(0.0852,0.136,0.8072,0.6491,true,tracker_Window[1]) guiGridListSetSelectionMode(tracker_Grid,2) column = guiGridListAddColumn( tracker_Grid, "Nombre del jugador", 0.85 ) guiSetVisible ( tracker_Window[1], false ) trackmode = 1 trackedplayer = nil trackedarmor = nil trackedlocation = nil trackedcity = nil trackedweapon = nil trackedvehicle = nil function showPlayerButton() guiSetVisible ( tracker_Player, true ) end addEventHandler ( "onClientGUIClick", tracker_Grid, showPlayerButton) holoped = createPed ( 0, modelX, modelY, modelZ+1.4 ) setElementAlpha(holoped, 0) setPedFrozen(holoped, true) setElementCollisionsEnabled(holoped, false) setPedVoice(holoped, "PED_TYPE_DISABLED") function showTrackerGui ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) and (isPedOnGround ( getLocalPlayer())) then guiGridListClear(tracker_Grid) guiSetVisible ( tracker_Window[1], true ) guiBringToFront ( tracker_Window[1] ) guiSetVisible ( tracker_Player, false ) showCursor ( true ) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( tracker_Grid ) guiGridListSetItemText ( tracker_Grid, row, column, getPlayerName(playeritem), false, false ) end end end addEventHandler ( "onClientMarkerHit", trackerMarker, showTrackerGui ) function trackerMarkerLeave ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) then guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end end addEventHandler ( "onClientMarkerLeave", trackerMarker, trackerMarkerLeave ) function trackplayer() local itemrow,itemcolumn = guiGridListGetSelectedItem(tracker_Grid ) if itemrow ~= -1 then local playerName = guiGridListGetItemText (tracker_Grid, guiGridListGetSelectedItem(tracker_Grid ), 1 ) trackedplayer = getPlayerFromName(playerName) if trackedplayer ~= false then setElementModel(holoped,getElementModel(trackedplayer)) trackmode = 2 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode, trackedplayer ) end else trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) end guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", tracker_Player, trackplayer) function trackall() guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) setElementAlpha(holoped, 0) end addEventHandler ( "onClientGUIClick", tracker_All, trackall) addEvent( "onTrackerUpdated", true ) function syncTrackMode ( newtrackmode, newtrackedplayer ) if newtrackmode == 1 then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil elseif newtrackmode == 2 then trackmode = 2 trackedplayer = newtrackedplayer setElementModel(holoped,getElementModel(trackedplayer)) trackedarmor = nil end end addEventHandler( "onTrackerUpdated", getRootElement(), syncTrackMode ) function didTrackedplayerQuit() if source == trackedplayer then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil end end addEventHandler( "onClientPlayerQuit", getRootElement(), didTrackedplayerQuit ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEvent( "onTrackerInfoUpdate", true ) function syncTrackMode(vehicle, location, city, weapon, armor) if vehicle then trackedvehicle = vehicle end if location then trackedlocation = location end if city then trackedcity = city end if weapon then trackedweapon = weapon end if armor then trackedarmor = armor end end addEventHandler( "onTrackerInfoUpdate", getRootElement(), syncTrackMode ) Edited August 26, 2013 by Guest Link to comment
WASSIm. Posted August 26, 2013 Share Posted August 26, 2013 modelX, modelY, modelZ = 219.9765, 1822.8145, 6.533 -- minimap location showLegend = createColSphere ( modelX, modelY, modelZ, 13 ) --colshape for activating nametags function makeMapMarker (player) local r, g, b = getPlayerNametagColor ( player ) local themarker = createMarker ( modelX, modelY, modelZ, "cylinder", .05, r, g, b, 255 ) setElementData ( player, "Radar_marker", themarker, false ) end function ResourceStart(startedresource) if startedresource == getThisResource() then Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do makeMapMarker (v) end setTimer(Radar_check, 250, 0) end end addEventHandler( "onClientResourceStart", getRootElement(), ResourceStart ) function PlayerJoin ( ) makeMapMarker (source) end addEventHandler( "onClientPlayerJoin", getRootElement(), PlayerJoin) function PlayerQuit ( ) destroyElement( getElementData ( source, "Radar_marker" ) ) end addEventHandler( "onClientPlayerQuit", getRootElement(), PlayerQuit) function Radar_check() Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do if isElement(v) then x,y,z = getElementPosition ( v ) x = x / 1642.935378 y = y / 1642.935378 z = z / 1642.935378 local themarker = getElementData ( v, "Radar_marker" ) setElementPosition ( themarker, modelX-y, modelY+x, modelZ+z ) --Whack math is because west is north on 3d model end end end function ColShapeHit ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if not mapNamesHandler then mapNamesHandler = addEventHandler ( "onClientRender", root, ClientRender ) end end end addEventHandler("onClientColShapeHit",showLegend,ColShapeHit) function ColShapeLeave ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if mapNamesHandler then removeEventHandler ( "onClientRender", root, ClientRender ) mapNamesHandler = nil end end end addEventHandler("onClientColShapeLeave", showLegend, ColShapeLeave ) function ClientRender () if trackmode == 1 then local Radar_items = getElementsByType( "player" ) for k,v in pairs(Radar_items) do local r, g, b, a = getMarkerColor ( getElementData ( v, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( v, "Radar_marker" ) ) local zOffset = (k/20)+.3 local screenX, screenY = getScreenFromWorldPosition ( x, y, z + zOffset ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local name = getPlayerName ( v ) dxDrawText ( name, screenX, screenY, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true) dxDrawLine ( screenX, screenY+13, screenXX, screenYY, tocolor(r,g,b), 1 ) end end elseif trackmode == 2 then local randomalpha = math.random( 70, 200 ) setElementAlpha(holoped, randomalpha) local r, g, b, a = getMarkerColor ( getElementData ( trackedplayer, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( trackedplayer, "Radar_marker" ) ) local zOffset = .3 local screenX, screenY = getScreenFromWorldPosition ( modelX, modelY, modelZ+.4 ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local screenXXX, screenYYY = getScreenFromWorldPosition ( modelX, modelY, modelZ+1.5 ) if screenXXX ~= false then local name = getPlayerName (trackedplayer) dxDrawText ( name, screenXXX+40, screenYYY-15, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true) local hp = getElementHealth ( trackedplayer) roundedhp = math.round(hp) if trackedarmor ~= nil then dxDrawText ( "Vida: "..roundedhp, screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Armadura: "..trackedarmor, screenXXX+40, screenYYY+15, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Ubicacion: "..trackedlocation..", "..trackedcity, screenXXX+40, screenYYY+30, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Arma: "..trackedweapon, screenXXX+40, screenYYY+45, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Vehiculo: "..trackedvehicle, screenXXX+40, screenYYY+60, screenX, screenY, tocolor(r, g, b) ) else dxDrawText ( "Escaneando...", screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) end end dxDrawLine ( screenX, screenY, screenXX, screenYY, tocolor(r,g,b), 1 ) end end end trackedvehicle = nil trackerMarker = createMarker (modelX-7.5596, modelY+.022, modelZ-1.019, "cylinder", 1.5, 255, 255, 0, 40 ) tracker_Window = {} tracker_Button = {} tracker_Grid = {} tracker_Window[1] = guiCreateWindow(123,142,223,228,"Contro de Seguimiento",false) guiWindowSetSizable(tracker_Window[1],false) tracker_Player = guiCreateButton(0.0942,0.8114,0.3901,0.136,"Mirar Jugador",true,tracker_Window[1]) tracker_All = guiCreateButton(0.5022,0.8158,0.3901,0.1316,"Mirar Todos",true,tracker_Window[1]) tracker_Grid = guiCreateGridList(0.0852,0.136,0.8072,0.6491,true,tracker_Window[1]) guiGridListSetSelectionMode(tracker_Grid,2) column = guiGridListAddColumn( tracker_Grid, "Nombre del jugador", 0.85 ) guiSetVisible ( tracker_Window[1], false ) trackmode = 1 trackedplayer = nil trackedarmor = nil trackedlocation = nil trackedcity = nil trackedweapon = nil trackedvehicle = nil function showPlayerButton() guiSetVisible ( tracker_Player, true ) end addEventHandler ( "onClientGUIClick", tracker_Grid, showPlayerButton) holoped = createPed ( 0, modelX, modelY, modelZ+1.4 ) setElementAlpha(holoped, 0) setPedFrozen(holoped, true) setElementCollisionsEnabled(holoped, false) setPedVoice(holoped, "PED_TYPE_DISABLED") function showTrackerGui ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) and (isPedOnGround ( getLocalPlayer())) then guiGridListClear(tracker_Grid) guiSetVisible ( tracker_Window[1], true ) guiBringToFront ( tracker_Window[1] ) guiSetVisible ( tracker_Player, false ) showCursor ( true ) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( tracker_Grid ) guiGridListSetItemText ( tracker_Grid, row, column, getPlayerName(playeritem), false, false ) end end end addEventHandler ( "onClientMarkerHit", trackerMarker, showTrackerGui ) function trackerMarkerLeave ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) then guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end end addEventHandler ( "onClientMarkerLeave", trackerMarker, trackerMarkerLeave ) function trackplayer() local itemrow,itemcolumn = guiGridListGetSelectedItem(tracker_Grid ) if itemrow ~= -1 then local playerName = guiGridListGetItemText (tracker_Grid, guiGridListGetSelectedItem(tracker_Grid ), 1 ) trackedplayer = getPlayerFromName(playerName) if trackedplayer ~= false then setElementModel(holoped,getElementModel(trackedplayer)) trackmode = 2 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode, trackedplayer ) end else trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) end guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", tracker_Player, trackplayer) function trackall() guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) setElementAlpha(holoped, 0) end addEventHandler ( "onClientGUIClick", tracker_All, trackall) addEvent( "onTrackerUpdated", true ) function syncTrackMode ( newtrackmode, newtrackedplayer ) if newtrackmode == 1 then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil elseif newtrackmode == 2 then trackmode = 2 trackedplayer = newtrackedplayer setElementModel(holoped,getElementModel(trackedplayer)) trackedarmor = nil end end addEventHandler( "onTrackerUpdated", getRootElement(), syncTrackMode ) function didTrackedplayerQuit() if source == trackedplayer then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil end end addEventHandler( "onClientPlayerQuit", getRootElement(), didTrackedplayerQuit ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEvent( "onTrackerInfoUpdate", true ) function syncTrackMode(vehicle, location, city, weapon, armor) if vehicle then trackedvehicle = vehicle end if location then trackedlocation = location end if city then trackedcity = city end if weapon then trackedweapon = weapon end if armor then trackedarmor = armor end end addEventHandler( "onTrackerInfoUpdate", getRootElement(), syncTrackMode ) Link to comment
Flipi Posted August 26, 2013 Author Share Posted August 26, 2013 Wow thanks . PD: how to hide color codes in the names on this? screen: http://img827.imageshack.us/img827/4316/wsfn.png Link to comment
WASSIm. Posted August 26, 2013 Share Posted August 26, 2013 modelX, modelY, modelZ = 219.9765, 1822.8145, 6.533 -- minimap location showLegend = createColSphere ( modelX, modelY, modelZ, 13 ) --colshape for activating nametags function makeMapMarker (player) local r, g, b = getPlayerNametagColor ( player ) local themarker = createMarker ( modelX, modelY, modelZ, "cylinder", .05, r, g, b, 255 ) setElementData ( player, "Radar_marker", themarker, false ) end function ResourceStart(startedresource) if startedresource == getThisResource() then Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do makeMapMarker (v) end setTimer(Radar_check, 250, 0) end end addEventHandler( "onClientResourceStart", getRootElement(), ResourceStart ) function PlayerJoin ( ) makeMapMarker (source) end addEventHandler( "onClientPlayerJoin", getRootElement(), PlayerJoin) function PlayerQuit ( ) destroyElement( getElementData ( source, "Radar_marker" ) ) end addEventHandler( "onClientPlayerQuit", getRootElement(), PlayerQuit) function Radar_check() Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do if isElement(v) then x,y,z = getElementPosition ( v ) x = x / 1642.935378 y = y / 1642.935378 z = z / 1642.935378 local themarker = getElementData ( v, "Radar_marker" ) setElementPosition ( themarker, modelX-y, modelY+x, modelZ+z ) --Whack math is because west is north on 3d model end end end function ColShapeHit ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if not mapNamesHandler then mapNamesHandler = addEventHandler ( "onClientRender", root, ClientRender ) end end end addEventHandler("onClientColShapeHit",showLegend,ColShapeHit) function ColShapeLeave ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if mapNamesHandler then removeEventHandler ( "onClientRender", root, ClientRender ) mapNamesHandler = nil end end end addEventHandler("onClientColShapeLeave", showLegend, ColShapeLeave ) function ClientRender () if trackmode == 1 then local Radar_items = getElementsByType( "player" ) for k,v in pairs(Radar_items) do local r, g, b, a = getMarkerColor ( getElementData ( v, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( v, "Radar_marker" ) ) local zOffset = (k/20)+.3 local screenX, screenY = getScreenFromWorldPosition ( x, y, z + zOffset ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local name = getPlayerName ( v ) dxDrawText ( name, screenX, screenY, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true) dxDrawLine ( screenX, screenY+13, screenXX, screenYY, tocolor(r,g,b), 1 ) end end elseif trackmode == 2 then local randomalpha = math.random( 70, 200 ) setElementAlpha(holoped, randomalpha) local r, g, b, a = getMarkerColor ( getElementData ( trackedplayer, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( trackedplayer, "Radar_marker" ) ) local zOffset = .3 local screenX, screenY = getScreenFromWorldPosition ( modelX, modelY, modelZ+.4 ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local screenXXX, screenYYY = getScreenFromWorldPosition ( modelX, modelY, modelZ+1.5 ) if screenXXX ~= false then local name = getPlayerName (trackedplayer) dxDrawText ( name, screenXXX+40, screenYYY-15, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true) local hp = getElementHealth ( trackedplayer) roundedhp = math.round(hp) if trackedarmor ~= nil then dxDrawText ( "Vida: "..roundedhp, screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Armadura: "..trackedarmor, screenXXX+40, screenYYY+15, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Ubicacion: "..trackedlocation..", "..trackedcity, screenXXX+40, screenYYY+30, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Arma: "..trackedweapon, screenXXX+40, screenYYY+45, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Vehiculo: "..trackedvehicle, screenXXX+40, screenYYY+60, screenX, screenY, tocolor(r, g, b) ) else dxDrawText ( "Escaneando...", screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) end end dxDrawLine ( screenX, screenY, screenXX, screenYY, tocolor(r,g,b), 1 ) end end end trackedvehicle = nil trackerMarker = createMarker (modelX-7.5596, modelY+.022, modelZ-1.019, "cylinder", 1.5, 255, 255, 0, 40 ) tracker_Window = {} tracker_Button = {} tracker_Grid = {} tracker_Window[1] = guiCreateWindow(123,142,223,228,"Contro de Seguimiento",false) guiWindowSetSizable(tracker_Window[1],false) tracker_Player = guiCreateButton(0.0942,0.8114,0.3901,0.136,"Mirar Jugador",true,tracker_Window[1]) tracker_All = guiCreateButton(0.5022,0.8158,0.3901,0.1316,"Mirar Todos",true,tracker_Window[1]) tracker_Grid = guiCreateGridList(0.0852,0.136,0.8072,0.6491,true,tracker_Window[1]) guiGridListSetSelectionMode(tracker_Grid,2) column = guiGridListAddColumn( tracker_Grid, "Nombre del jugador", 0.85 ) guiSetVisible ( tracker_Window[1], false ) trackmode = 1 trackedplayer = nil trackedarmor = nil trackedlocation = nil trackedcity = nil trackedweapon = nil trackedvehicle = nil function showPlayerButton() guiSetVisible ( tracker_Player, true ) end addEventHandler ( "onClientGUIClick", tracker_Grid, showPlayerButton) holoped = createPed ( 0, modelX, modelY, modelZ+1.4 ) setElementAlpha(holoped, 0) setPedFrozen(holoped, true) setElementCollisionsEnabled(holoped, false) setPedVoice(holoped, "PED_TYPE_DISABLED") function showTrackerGui ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) and (isPedOnGround ( getLocalPlayer())) then guiGridListClear(tracker_Grid) guiSetVisible ( tracker_Window[1], true ) guiBringToFront ( tracker_Window[1] ) guiSetVisible ( tracker_Player, false ) showCursor ( true ) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( tracker_Grid ) local name = getPlayerName(playeritem) local name_ = name:gsub ( "#%x%x%x%x%x%x", "" ) guiGridListSetItemText ( tracker_Grid, row, column, name_, false, false ) end end end addEventHandler ( "onClientMarkerHit", trackerMarker, showTrackerGui ) function trackerMarkerLeave ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) then guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end end addEventHandler ( "onClientMarkerLeave", trackerMarker, trackerMarkerLeave ) function trackplayer() local itemrow,itemcolumn = guiGridListGetSelectedItem(tracker_Grid ) if itemrow ~= -1 then local playerName = guiGridListGetItemText (tracker_Grid, guiGridListGetSelectedItem(tracker_Grid ), 1 ) trackedplayer = getPlayerFromName(playerName) if trackedplayer ~= false then setElementModel(holoped,getElementModel(trackedplayer)) trackmode = 2 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode, trackedplayer ) end else trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) end guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", tracker_Player, trackplayer) function trackall() guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) setElementAlpha(holoped, 0) end addEventHandler ( "onClientGUIClick", tracker_All, trackall) addEvent( "onTrackerUpdated", true ) function syncTrackMode ( newtrackmode, newtrackedplayer ) if newtrackmode == 1 then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil elseif newtrackmode == 2 then trackmode = 2 trackedplayer = newtrackedplayer setElementModel(holoped,getElementModel(trackedplayer)) trackedarmor = nil end end addEventHandler( "onTrackerUpdated", getRootElement(), syncTrackMode ) function didTrackedplayerQuit() if source == trackedplayer then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil end end addEventHandler( "onClientPlayerQuit", getRootElement(), didTrackedplayerQuit ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEvent( "onTrackerInfoUpdate", true ) function syncTrackMode(vehicle, location, city, weapon, armor) if vehicle then trackedvehicle = vehicle end if location then trackedlocation = location end if city then trackedcity = city end if weapon then trackedweapon = weapon end if armor then trackedarmor = armor end end addEventHandler( "onTrackerInfoUpdate", getRootElement(), syncTrackMode ) Link to comment
Flipi Posted August 26, 2013 Author Share Posted August 26, 2013 Not working screen: http://img69.imageshack.us/img69/7476/oey4.png Its function was this screen2: http://imageshack.us/a/img543/1527/f0ez.png Link to comment
xXMADEXx Posted August 26, 2013 Share Posted August 26, 2013 Try this: modelX, modelY, modelZ = 219.9765, 1822.8145, 6.533 -- minimap location showLegend = createColSphere ( modelX, modelY, modelZ, 13 ) --colshape for activating nametags function makeMapMarker (player) local r, g, b = getPlayerNametagColor ( player ) local themarker = createMarker ( modelX, modelY, modelZ, "cylinder", .05, r, g, b, 255 ) setElementData ( player, "Radar_marker", themarker, false ) end function ResourceStart(startedresource) if startedresource == getThisResource() then Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do makeMapMarker (v) end setTimer(Radar_check, 250, 0) end end addEventHandler( "onClientResourceStart", getRootElement(), ResourceStart ) function PlayerJoin ( ) makeMapMarker (source) end addEventHandler( "onClientPlayerJoin", getRootElement(), PlayerJoin) function PlayerQuit ( ) destroyElement( getElementData ( source, "Radar_marker" ) ) end addEventHandler( "onClientPlayerQuit", getRootElement(), PlayerQuit) function Radar_check() Radar_items = getElementsByType( "player" ) for k,v in ipairs(Radar_items) do if isElement(v) then x,y,z = getElementPosition ( v ) x = x / 1642.935378 y = y / 1642.935378 z = z / 1642.935378 local themarker = getElementData ( v, "Radar_marker" ) setElementPosition ( themarker, modelX-y, modelY+x, modelZ+z ) --Whack math is because west is north on 3d model end end end function ColShapeHit ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if not mapNamesHandler then mapNamesHandler = addEventHandler ( "onClientRender", root, ClientRender ) end end end addEventHandler("onClientColShapeHit",showLegend,ColShapeHit) function ColShapeLeave ( theElement, matchingDimension ) if theElement == getLocalPlayer() then if mapNamesHandler then removeEventHandler ( "onClientRender", root, ClientRender ) mapNamesHandler = nil end end end addEventHandler("onClientColShapeLeave", showLegend, ColShapeLeave ) function ClientRender () if trackmode == 1 then local Radar_items = getElementsByType( "player" ) for k,v in pairs(Radar_items) do local r, g, b, a = getMarkerColor ( getElementData ( v, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( v, "Radar_marker" ) ) local zOffset = (k/20)+.3 local screenX, screenY = getScreenFromWorldPosition ( x, y, z + zOffset ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local name = getPlayerName ( v ) dxDrawText ( name, screenX, screenY, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true) dxDrawLine ( screenX, screenY+13, screenXX, screenYY, tocolor(r,g,b), 1 ) end end elseif trackmode == 2 then local randomalpha = math.random( 70, 200 ) setElementAlpha(holoped, randomalpha) local r, g, b, a = getMarkerColor ( getElementData ( trackedplayer, "Radar_marker" ) ) local x, y, z = getElementPosition ( getElementData ( trackedplayer, "Radar_marker" ) ) local zOffset = .3 local screenX, screenY = getScreenFromWorldPosition ( modelX, modelY, modelZ+.4 ) local screenXX, screenYY = getScreenFromWorldPosition ( x, y, z ) --For the marker if screenX ~= false and screenXX ~= false then local screenXXX, screenYYY = getScreenFromWorldPosition ( modelX, modelY, modelZ+1.5 ) if screenXXX ~= false then local name = getPlayerName (trackedplayer) dxDrawText ( name, screenXXX+40, screenYYY-15, screenX, screenY, tocolor(r, g, b), 1, "default", "left", "top", false, false, false, true ) local hp = getElementHealth ( trackedplayer ) roundedhp = math.round(hp) if trackedarmor ~= nil then dxDrawText ( "Vida: "..roundedhp, screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Armadura: "..trackedarmor, screenXXX+40, screenYYY+15, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Ubicacion: "..trackedlocation..", "..trackedcity, screenXXX+40, screenYYY+30, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Arma: "..trackedweapon, screenXXX+40, screenYYY+45, screenX, screenY, tocolor(r, g, b) ) dxDrawText ( "Vehiculo: "..trackedvehicle, screenXXX+40, screenYYY+60, screenX, screenY, tocolor(r, g, b) ) else dxDrawText ( "Escaneando...", screenXXX+40, screenYYY, screenX, screenY, tocolor(r, g, b) ) end end dxDrawLine ( screenX, screenY, screenXX, screenYY, tocolor(r,g,b), 1 ) end end end trackedvehicle = nil trackerMarker = createMarker (modelX-7.5596, modelY+.022, modelZ-1.019, "cylinder", 1.5, 255, 255, 0, 40 ) tracker_Window = {} tracker_Button = {} tracker_Grid = {} tracker_Window[1] = guiCreateWindow(123,142,223,228,"Contro de Seguimiento",false) guiWindowSetSizable(tracker_Window[1],false) tracker_Player = guiCreateButton(0.0942,0.8114,0.3901,0.136,"Mirar Jugador",true,tracker_Window[1]) tracker_All = guiCreateButton(0.5022,0.8158,0.3901,0.1316,"Mirar Todos",true,tracker_Window[1]) tracker_Grid = guiCreateGridList(0.0852,0.136,0.8072,0.6491,true,tracker_Window[1]) guiGridListSetSelectionMode(tracker_Grid,2) column = guiGridListAddColumn( tracker_Grid, "Nombre del jugador", 0.85 ) guiSetVisible ( tracker_Window[1], false ) trackmode = 1 trackedplayer = nil trackedarmor = nil trackedlocation = nil trackedcity = nil trackedweapon = nil trackedvehicle = nil function showPlayerButton() guiSetVisible ( tracker_Player, true ) end addEventHandler ( "onClientGUIClick", tracker_Grid, showPlayerButton) holoped = createPed ( 0, modelX, modelY, modelZ+1.4 ) setElementAlpha(holoped, 0) setPedFrozen(holoped, true) setElementCollisionsEnabled(holoped, false) setPedVoice(holoped, "PED_TYPE_DISABLED") function showTrackerGui ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) and (isPedOnGround ( getLocalPlayer())) then guiGridListClear(tracker_Grid) guiSetVisible ( tracker_Window[1], true ) guiBringToFront ( tracker_Window[1] ) guiSetVisible ( tracker_Player, false ) showCursor ( true ) for id, playeritem in ipairs(getElementsByType("player")) do local row = guiGridListAddRow ( tracker_Grid ) local name = getPlayerName(playeritem):gsub ( "#%x%x%x%x%x%x", "" ) guiGridListSetItemText ( tracker_Grid, row, column, name, false, false ) end end end addEventHandler ( "onClientMarkerHit", trackerMarker, showTrackerGui ) function trackerMarkerLeave ( hitPlayer, matchingDimension ) if (hitPlayer == getLocalPlayer()) then guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end end addEventHandler ( "onClientMarkerLeave", trackerMarker, trackerMarkerLeave ) function trackplayer() local itemrow,itemcolumn = guiGridListGetSelectedItem(tracker_Grid ) if itemrow ~= -1 then local playerName = guiGridListGetItemText (tracker_Grid, guiGridListGetSelectedItem(tracker_Grid ), 1 ) trackedplayer = getPlayerFromName(playerName) if trackedplayer ~= false then setElementModel(holoped,getElementModel(trackedplayer)) trackmode = 2 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode, trackedplayer ) end else trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) end guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) end addEventHandler ( "onClientGUIClick", tracker_Player, trackplayer) function trackall() guiSetVisible ( tracker_Window[1], false ) showCursor ( false ) trackmode = 1 triggerServerEvent ("onTrackModeChange", getLocalPlayer(), trackmode ) setElementAlpha(holoped, 0) end addEventHandler ( "onClientGUIClick", tracker_All, trackall) addEvent( "onTrackerUpdated", true ) function syncTrackMode ( newtrackmode, newtrackedplayer ) if newtrackmode == 1 then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil elseif newtrackmode == 2 then trackmode = 2 trackedplayer = newtrackedplayer setElementModel(holoped,getElementModel(trackedplayer)) trackedarmor = nil end end addEventHandler( "onTrackerUpdated", getRootElement(), syncTrackMode ) function didTrackedplayerQuit() if source == trackedplayer then trackmode = 1 setElementAlpha(holoped, 0) trackedarmor = nil end end addEventHandler( "onClientPlayerQuit", getRootElement(), didTrackedplayerQuit ) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end addEvent( "onTrackerInfoUpdate", true ) function syncTrackMode(vehicle, location, city, weapon, armor) if vehicle then trackedvehicle = vehicle end if location then trackedlocation = location end if city then trackedcity = city end if weapon then trackedweapon = weapon end if armor then trackedarmor = armor end end addEventHandler( "onTrackerInfoUpdate", getRootElement(), syncTrackMode ) Link to comment
Flipi Posted August 26, 2013 Author Share Posted August 26, 2013 not work this function screen: http://img69.imageshack.us/img69/7476/oey4.png 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