The Killer Posted November 29, 2013 Share Posted November 29, 2013 Hello how can i do when someone hit the marker then the dxDrawText show to him and only him no one else ? Link to comment
pa3ck Posted November 29, 2013 Share Posted November 29, 2013 addEventHandler("onClientMarkerHit", myMarker, function(hitPlayer) -- Or you could use getRootElement() instead of marker, if you want to show the test if he hits any marker. if hitPlayer == getLocalPlayer() then dxDrawText(....) end end) Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 In order for the text to stay visible continuously, you need to call this function with the same parameters on each frame update (see onClientRender). Link to comment
The Killer Posted November 29, 2013 Author Share Posted November 29, 2013 this code when you hit the marker the count will show but the other players can see it to i want when someone hit the marker the count show, only the player who hit the marker can see it. local count = 10 local x,y = guiGetScreenSize( ) local left,top,right,bottom = x*351/1360,y*166/768,x*999/1360,y*454/768 setTimer ( function ( ) count = count -1 if ( count == 0 ) then removeEventHandler("onClientRender",root,DrawTheText) triggerServerEvent("give", getLocalPlayer()) end end,500,0 ) function DrawTheText( ) dxDrawText( "Wait [ " .. count .. " ]",left,top,right,bottom, tocolor(0,255,0,255), 2.00, "default-bold", "center", "top", false, false, false, false, false ) end local marker = createMarker(1956.6, -2486, 13.5-1, "cylinder", 2, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function () count = 10 addEventHandler("onClientRender",root,DrawTheText) end ) Link to comment
manve1 Posted November 29, 2013 Share Posted November 29, 2013 local count = 10 local x,y = guiGetScreenSize( ) local left,top,right,bottom = x*351/1360,y*166/768,x*999/1360,y*454/768 setTimer ( function ( ) count = count -1 if ( count == 0 ) then removeEventHandler("onClientRender",root,DrawTheText) triggerServerEvent("give", getLocalPlayer()) end end,500,0 ) function DrawTheText( ) dxDrawText( "Wait [ " .. count .. " ]",left,top,right,bottom, tocolor(0,255,0,255), 2.00, "default-bold", "center", "top", false, false, false, false, false ) end local marker = createMarker(1956.6, -2486, 13.5-1, "cylinder", 2, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function (p) if p == localPlayer then count = 10 addEventHandler("onClientRender",root,DrawTheText) end end ) Link to comment
The Killer Posted November 29, 2013 Author Share Posted November 29, 2013 Thanks, but there is another problem that when i start the mode it's give me the money with out hit the marker only when i start it. Link to comment
Gallardo9944 Posted November 29, 2013 Share Posted November 29, 2013 then try getting the distance between the marker and the player (if it's less than marker radius, then trigger the money give) Link to comment
TAPL Posted November 29, 2013 Share Posted November 29, 2013 local x,y = guiGetScreenSize( ) local left,top,right,bottom = x*351/1360,y*166/768,x*999/1360,y*454/768 function DrawTheText() if isTimer(tt) then _, count = getTimerDetails(tt) dxDrawText("Wait [ "..tostring(count).." ]",left,top,right,bottom, tocolor(0,255,0,255), 2.00, "default-bold", "center", "top", false, false, false, false, false) else removeEventHandler("onClientRender", root, DrawTheText) triggerServerEvent("give", getLocalPlayer()) end end local marker = createMarker(1956.6, -2486, 13.5-1, "cylinder", 2, 255, 0, 0) addEventHandler("onClientMarkerHit", marker, function (p) if p == localPlayer and not isTimer(tt) then tt = setTimer(function() end, 1000, 10) addEventHandler("onClientRender", root, DrawTheText) end 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