Mars2 Posted October 10, 2015 Share Posted October 10, 2015 السلام عليكم local marker1 = createMarker(207.19234,1920.68762,16.64063, 'cylinder',2,143, 155, 154) function markerHiteko1(playerTeam1) if getElementType(playerTeam1) == "player" then if getPlayerTeam(playerTeam1) and getTeamName(getPlayerTeam(playerTeam1)) == "Team" then if getPlayerMoney ( playerTeam1 ) then takePlayerMoney ( playerTeam1, 40000 ) setElementDimension (playerTeam1, 2 ) setElementPosition (playerTeam1, 202.87492,1896.65649,17.64063 ) outputChatBox ( "تم نقلك الى العالم الوهمي", playerTeam1,0,255,0 ) else outputChatBox ( "انت لست بالتيم" ,playerTeam1,255,0,0 ) end end end end addEventHandler( "onMarkerHit", marker1,markerHiteko1) الكود عند لمس الماركر يتحقق من اسم التيم لو موجود ينقله ويخصم منه فلوس وينقله لعالم وهمي لكن المشكله انه لما تكون الفلوس 0 تصير بالسالب ابي يقوله لا تملك المال ما ابيها تصير سالب ابي الكود فقط الي ما يخليه سالب وما ابي احد يعطيني جاهز مشان اعرف خطأي Link to comment
TAPL Posted October 10, 2015 Share Posted October 10, 2015 ليش صاف الكود فوق بعضه رتب الكود ذا راح يساعدك قبل ما يساعدنا بقراءة و فهم الكود local marker1 = createMarker(207.19, 1920.688, 16.64, "cylinder", 2, 143, 155, 154) function markerHiteko1(playerTeam1) if getElementType(playerTeam1) == "player" then local team = getPlayerTeam(playerTeam1) if team and getTeamName(team) == "Team" then if getPlayerMoney(playerTeam1) >= 40000 then takePlayerMoney(playerTeam1, 40000) setElementDimension(playerTeam1, 2) setElementPosition(playerTeam1, 202.88, 1896.65, 17.65) outputChatBox("تم نقلك الى العالم الوهمي", playerTeam1, 0, 255, 0) else outputChatBox("لا تملك المال ", playerTeam1, 255, 0, 0) end else outputChatBox("انت لست بالتيم", playerTeam1, 255, 0, 0) end end end addEventHandler("onMarkerHit", marker1, markerHiteko1) Link to comment
Mars2 Posted October 10, 2015 Author Share Posted October 10, 2015 اخوي ترا انا ما استفدت منك انت غيرت وحطيت متغيرات وكذا ما راح افهم بدي تقولي بس وش الاكواد الي اضيفها على كودي لانه انت حطيت عليه متغيرات وانا ما ابي متغيرات Link to comment
TAPL Posted October 10, 2015 Share Posted October 10, 2015 انت استخدمت الفنكشن الي يجيب تيم اللاعب مرتين وذا يعتبر هدر لموارد السيرفر اتباع نفس اسلوب هدر الموارد مع جميع اكواد المودات راح يسبب استهلاك عالي لموارد السيرفر و بالتالي لاق عموماً بالنسبة لكودك كان تحتاج تغير السطر ذا if getPlayerMoney ( playerTeam1 ) then إلى if getPlayerMoney ( playerTeam1 ) >= 40000 then Link to comment
Mars2 Posted October 10, 2015 Author Share Posted October 10, 2015 طيب اخوي تابل عندي سؤال بخصوص المسج الي هو اكمال التحقق else يعني انت ضفت سطر لا تملك المال هوه كيف بده يعرف انو تحقق؟ Link to comment
TAPL Posted October 10, 2015 Share Posted October 10, 2015 انا عطيتك الكود و تقدر تشوف كيف اضفت التحقق Link to comment
Mars2 Posted October 10, 2015 Author Share Posted October 10, 2015 اوكي شكرا اخوي ما قصرت Link to comment
TAPL Posted October 10, 2015 Share Posted October 10, 2015 ذي الصورة تشوف فيها اللون الأخضر والتحقق التابع له و اللون الأصفر و التحقق التابع له و اللون الأحمر و التحقق التابع له متوازين بالمسافة if else end و تقدر تشوف السطور التابعة لبعضها Link to comment
Mars2 Posted October 10, 2015 Author Share Posted October 10, 2015 متوازين بالمسافة if else 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