justn Posted March 29, 2014 Share Posted March 29, 2014 (edited) So, what i need help is setting the DxText visible to only the player who hits the marker.. and how do I make ( for example ) if the player is in criminal team then when he hits the marker it will show " Gangster: 1 " and if another Criminal joins it will be " Gangster: 2 " function onGangster (hitPlayer,interior,matchingDimension) if ( hitPlayer == localPlayer ) then if getTeamName(getPlayerTeam(localPlayer)) ~= "Police" or getTeamName(getPlayerTeam(localPlayer)) ~= "Medic" then setElementInterior ( localPlayer, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) setElementDimension ( localPlayer, 5 ) dxDrawText("Police: ", 11, 738, 207, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 11, 736, 207, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 9, 738, 205, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 9, 736, 205, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 10, 737, 206, 762, tocolor(66, 0, 254, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Gangster: ", 217, 739, 477, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 217, 737, 477, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 215, 739, 475, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 215, 737, 475, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 216, 738, 476, 762, tocolor(253, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Medic:", 495, 738, 686, 759, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 495, 736, 686, 757, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 493, 738, 684, 759, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 493, 736, 684, 757, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 494, 737, 685, 758, tocolor(20, 232, 225, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) end end end addEventHandler("onClientMarkerHit", gangsterMarker, onGangster ) addEventHandler("onClientRender", root, onGangster ) Edited March 29, 2014 by Guest Link to comment
Anubhav Posted March 29, 2014 Share Posted March 29, 2014 function onGangster (hitPlayer,interior,matchingDimension) if ( hitPlayer == localPlayer ) then if getTeamName(getPlayerTeam(hitElement)) == "Police" or getTeamName(getPlayerTeam(hitElement)) == "Medic" then setElementInterior ( localPlayer, 5, 1300.1059570313, -792.5771484375, 1085.00778125 ) setElementDimension ( localPlayer, 5 ) dxDrawText("Police: ", 11, 738, 207, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 11, 736, 207, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 9, 738, 205, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 9, 736, 205, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Police: ", 10, 737, 206, 762, tocolor(66, 0, 254, 255), 1.00, "bankgothic", "left", "top", false, false, true, true, false) dxDrawText("Gangster: ", 217, 739, 477, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 217, 737, 477, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 215, 739, 475, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 215, 737, 475, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: ", 216, 738, 476, 762, tocolor(253, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Medic:", 495, 738, 686, 759, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 495, 736, 686, 757, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 493, 738, 684, 759, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 493, 736, 684, 757, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) dxDrawText("Medic:", 494, 737, 685, 758, tocolor(20, 232, 225, 255), 1.00, "bankgothic", "left", "top", true, false, true, true, false) end end end addEventHandler("onClientMarkerHit", gangsterMarker, onGangster ) addEventHandler("onClientRender", root, onGangster ) Link to comment
justn Posted March 29, 2014 Author Share Posted March 29, 2014 Can you help me make so if player is in criminal team and hits marker then the dxdrawtext will be "Gangster: 1" and if another join then it will be "Gangster:2" Link to comment
Anubhav Posted March 29, 2014 Share Posted March 29, 2014 local marker = createMarker(...) local playerInM = 0 function onMarkerHit(hitElement) if getTeamName(getPlayerTeam(hitElement)) == "Criminal" then playerInM = playerInM+1 triggerClientEvent("markerUpdated",root,playerInM) end end addEventHandler("onMarkerHit",marker,onMarkerHit) function onMarkerLeave(leftElement) if getTeamName(getPlayerTeam(hitElement)) == "Criminal" then playerInM = playerInM-1 triggerClientEvent("markerUpdated1",root,playerInM) end end addEventHandler( "onMarkerLeave", myMarker, onMarkerLeave ) Cliented local inMarker = 0 function updated(playerInM) inMarker = inMarker+1 end addEvent("markerUpdated",true) addEventHandler("markerUpdated",root,updated) function upated1(playerInM) inMarker = inMarker-1 end addEvent("markerUpdated1",true) addEventHandler("markerUpdated1",root,updated) function render() dxDrawText("Gangster: "...tostring(inMarker), 217, 739, 477, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: "...tostring(inMarker), 217, 737, 477, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: "...tostring(inMarker), 215, 739, 475, 763, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: "...tostring(inMarker), 215, 737, 475, 761, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) dxDrawText("Gangster: "...tostring(inMarker), 216, 738, 476, 762, tocolor(253, 0, 0, 255), 1.00, "bankgothic", "left", "top", true, true, true, true, false) end addEventHandler("onClientRender",root,render) 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