The_Rich# Posted June 10, 2019 Share Posted June 10, 2019 السلام عليكم ورحمة الله وبركاته ,, شباب عندي مشكلة مع فنكشن dxDrawTextOnElement ----------------------------------------------------------------------------------------------------------- أول شيء انا كنت اسوي كود والي هو لما يكتب بأف 8 كلمة معينة , يسوي الكاميرا في حارة سي جي .. Ped وسويت بحارة سي جي ped وقلت لما يكتب الكلمة المعينة بأف 8 , يقدر لما يضغط على زر معين يغير ال Ped ويكتب كلام فوق ال طيب , المشكلة هي اني لما اغير الشخصيات , الكلام يظهر لأقل من ثانية ويختفي .. --------------------------------------------------------------------------------------------- الأكواد :- function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end Skin = createPed(0,2496.24316, -1669.80396, 13.33595) setElementData(Skin,"Skin1",true) function Skins() if ( getElementData(Skin,"Skin1") == true ) then setElementModel(Skin,1) setElementData(Skin,"Skin1",false) dxDrawTextOnElement(Skin,"Skin Number 1",1,20,0,0,255,255,1,"pricedown") elseif ( getElementData(Skin,"Skin1" ) == false ) then dxDrawTextOnElement(Skin,"Skin Number 46",1,20,0,0,255,255,1,"pricedown") setElementModel(Skin,46) setElementData(Skin,"Skin1",true) end end addCommandHandler("Skin", function () setCameraMatrix(2490.21753, -1669.17590, 18.60828,2496.24316, -1669.80396, 13.33595) bindKey("Left","down", Skins) bindKey("Right","down", Skins) end) وشكراً # Link to comment
#BrosS Posted June 11, 2019 Share Posted June 11, 2019 استخدم الوظيفة داخل addEventHandler("onClientRender") ايضا نصيحة اذا ناوي تحط شخصيات كثيرة استعمل جدول وحط فيه السكنات ورقمها احسن ما تسوي 66 تحقق Link to comment
The_Rich# Posted June 11, 2019 Author Share Posted June 11, 2019 (edited) لسة مادخلت بمجال الجداول ي بروس , ماعندي خبرة فيها .. لوعندك شرح لها اتمنى ترسلي الموضوع . انا ابغى الكلام يظهر لما يدوس على الزر مع الشخصية , ادري انه لازم تحط onClientRender.. بس كيف استخدمها بهذي الحالة ؟ @#BrosS Edited June 11, 2019 by The_Rich# Link to comment
#BrosS Posted June 11, 2019 Share Posted June 11, 2019 function dxDrawTextOnElement(TheElement,text,height,distance,R,G,B,alpha,size,font,...) local x, y, z = getElementPosition(TheElement) local x2, y2, z2 = getCameraMatrix() local distance = distance or 20 local height = height or 1 if (isLineOfSightClear(x, y, z+2, x2, y2, z2, ...)) then local sx, sy = getScreenFromWorldPosition(x, y, z+height) if(sx) and (sy) then local distanceBetweenPoints = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) if(distanceBetweenPoints < distance) then dxDrawText(text, sx+2, sy+2, sx, sy, tocolor(R or 255, G or 255, B or 255, alpha or 255), (size or 1)-(distanceBetweenPoints / distance), font or "arial", "center", "center") end end end end Skin = createPed(0,2496.24316, -1669.80396, 13.33595) setElementData(Skin,"Skin1",true) text = "" function drawText() dxDrawTextOnElement(Skin,text,1,20,0,0,255,255,1,"pricedown") end function Skins() if ( getElementData(Skin,"Skin1") == true ) then setElementModel(Skin,1) setElementData(Skin,"Skin1",false) text = "Skin Number 1" elseif ( getElementData(Skin,"Skin1" ) == false ) then text = "Skin Number 46" setElementModel(Skin,46) setElementData(Skin,"Skin1",true) end end addCommandHandler("Skin", function () setCameraMatrix(2490.21753, -1669.17590, 18.60828,2496.24316, -1669.80396, 13.33595) bindKey("Left","down", Skins) bindKey("Right","down", Skins) addEventHandler("onClientRender",root,drawText) end) اذا تبي تحذف الكلام removeEventHandler("onClientRender",root,drawText) text أو تفرغ المتغير text = "" شرح الجداول Link to comment
The_Rich# Posted June 11, 2019 Author Share Posted June 11, 2019 ششكككراً ي بروس اظنها بداية موفقة لمشواري الفنّي 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