[DONE]* Posted March 14, 2015 Share Posted March 14, 2015 السلام عليكم و رحمه الله و بركاته كيف الحال شباب, انشاء الله بخير في عندي استفسار و هو : لما واحد يدخل ماركر يصنع بيد ولاكن ما اعرف كيف اخلي البيد يلحق الشخص الي دخل الماركر انشاء الله فهمتوا وشكرآ لكم Link to comment
nxFairlywell Posted March 15, 2015 Share Posted March 15, 2015 Event : "onMarkerHit" function : createPed attachElements Link to comment
Professional Posted March 15, 2015 Share Posted March 15, 2015 function MarkerHit( ) createPed(id, x, y, z) attachElements ( arrowMarker, thePlayer, x, y, z) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) Link to comment
The Killer Posted March 15, 2015 Share Posted March 15, 2015 Event # 'onClientMarkerHit' function # createMarker createPed getElementPosition getDistanceBetweenPoints3D setPedControlState Useful function # findRotation Link to comment
[DONE]* Posted March 15, 2015 Author Share Posted March 15, 2015 Event # 'onClientMarkerHit' function # createMarker createPed getElementPosition getDistanceBetweenPoints3D setPedControlState Useful function # findRotation سوي على آخر كودان مثال لاهنت و أذكر فائدتهم getDistanceBetweenPoints3D setPedControlState Link to comment
#|_oskar_|# Posted March 16, 2015 Share Posted March 16, 2015 سوي على آخر كودان مثال لاهنت و أذكر فائدتهم getDistanceBetweenPoints3D setPedControlState setPedControlState ( ped thePed, string control, bool state ) ped thePed = اسم البيد string control = سترنج مثال = "fire" bool state = القيمه false or true . Link to comment
The Killer Posted March 16, 2015 Share Posted March 16, 2015 سوي على آخر كودان مثال لاهنت و أذكر فائدتهم getDistanceBetweenPoints3D setPedControlState getDistanceBetweenPoints3D -- تجيب المسافه بين شي معين setPedControlState -- تخلي الشخصيه تسوي شي معين Example: ped = createPed(0, getElementPosition(localPlayer)) addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(ped) local dis = getDistanceBetweenPoints2D(x, y, tx, ty) if dis > 2 then setPedControlState(ped, "forwards", true) else setPedControlState(ped, "forwards", false) end setPedRotation(ped, findRotation(tx, ty, x, y)) end) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end Link to comment
[DONE]* Posted March 16, 2015 Author Share Posted March 16, 2015 (edited) سويت الكود وكل شي تمام ولاكن في مشكلة لما شخص يدخل الماركر يطلع البيد لكل الي بالتيم Client local marker2 = createMarker ( 1536.2789306641,-1686.3870849609,13.546875,"cylinder",2, 0,255, 0, 255) local blip2 = createBlip ( 1536.2789306641,-1686.3870849609,13.546875,5) addEventHandler("onClientMarkerHit", marker2, function () destroyElement ( ped ) end) local marker33 = createMarker ( 1536.2789306641,-1686.3870849609+5,13.546875,"cylinder",2, 0,255, 0, 255) addEventHandler("onClientMarkerHit", marker33, function () local player = getLocalPlayer() local playerTeam = getPlayerTeam ( player ) local TeamName = getTeamName ( playerTeam ) if ( TeamName == "No Team" ) then ped = createPed(0, getElementPosition(localPlayer)) end end) addEventHandler("onClientRender", root, function() local player = getLocalPlayer() local playerTeam = getPlayerTeam ( player ) local TeamName = getTeamName ( playerTeam ) if ( TeamName == "No Team" ) then local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(ped) local dis = getDistanceBetweenPoints2D(x, y, tx, ty) if dis > 2 then setPedControlState(ped, "forwards", true) else setPedControlState(ped, "forwards", false) end setPedRotation(ped, findRotation(tx, ty, x, y)) end end) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end Edited March 16, 2015 by Guest Link to comment
The Killer Posted March 16, 2015 Share Posted March 16, 2015 local marker2 = createMarker (1536.27,-1686.387,13.546,"cylinder", 2, 0, 255, 0, 255) local blip2 = createBlip (1536.27, -1686.387, 13.546,5) addEventHandler("onClientMarkerHit", marker2, function (hit) if (hit == localPlayer) then if isElement (ped) then destroyElement ( ped ) end end end ) local marker33 = createMarker ( 1536.27,-1686.387+5,13.54,"cylinder", 2, 0, 255, 0, 255) addEventHandler("onClientMarkerHit", marker33, function (hit) if (hit == localPlayer) then if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then ped = createPed(0, getElementPosition(localPlayer)) end end end ) addEventHandler("onClientRender", root, function() if getPlayerTeam (localPlayer) and getTeamName (getPlayerTeam (localPlayer)) == "No Team" then local x, y, z = getElementPosition(localPlayer) local tx, ty, tz = getElementPosition(ped) local dis = getDistanceBetweenPoints2D(x, y, tx, ty) if dis > 2 then setPedControlState(ped, "forwards", true) else setPedControlState(ped, "forwards", false) end setPedRotation(ped, findRotation(tx, ty, x, y)) end end ) function findRotation(x1,y1,x2,y2) local t = -math.deg(math.atan2(x2-x1,y2-y1)) if t < 0 then t = t + 360 end return t end Link to comment
[DONE]* Posted March 16, 2015 Author Share Posted March 16, 2015 مشكوووووووووووووور ,جزاك الله الف خير 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