Bo7meeeD Posted January 10, 2013 Share Posted January 10, 2013 السلام عليكم ورححمة الله شباب صلحولي الأخطاء ابغاه اذا ضرب الاعب يلحق الاعب اللي ضربه هذا الكود addEventHandler ( "onPlayerDamage", getRootElement (), function (attacker, wep) if attacker and getElementType(attacker) == "player" then theTeam = getPlayerTeam ( attacker ) wep = getPedWeapon ( attacker ) theWL = getPlayerWantedLevel ( source ) if getTeamName( theTeam ) == "police" and wep and theWL then attachElements ( source, attacker ) showCursor ( source, true ) end end end ) وشكككرا Link to comment
abu5lf Posted January 10, 2013 Share Posted January 10, 2013 https://community.multitheftauto.com/index.php?p= ... ils&id=292 Link to comment
3NAD Posted January 10, 2013 Share Posted January 10, 2013 -- لم يتم التجربة addEventHandler ( "onPlayerDamage", root, function ( attacker, wep ) if getElementType ( attacker ) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) if theTeam == getTeamFromName ( "police" ) then if wep == 3 and theWL >= 1 then if isTimer ( theTimer ) then killTimer ( theTimer ) end theTimer = setTimer ( function ( ) x, y, z = getElementRotation ( attacker ) setElementRotation ( source, x, y, z ) end , 500, 0 ) showCursor ( source, true ) setPedControlState ( source, "sprint", true ) end end end end ) Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 -- لم يتم التجربة addEventHandler ( "onPlayerDamage", root, function ( attacker, wep ) if getElementType ( attacker ) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) if theTeam == getTeamFromName ( "police" ) then if wep == 3 and theWL >= 1 then if isTimer ( theTimer ) then killTimer ( theTimer ) end theTimer = setTimer ( function ( ) x, y, z = getElementRotation ( attacker ) setElementRotation ( source, x, y, z ) end , 500, 0 ) showCursor ( source, true ) setPedControlState ( source, "sprint", true ) end end end end ) 1- جربته ولا ضبط 2- وش فايدة ذا الكود setElementRotation Link to comment
3NAD Posted January 12, 2013 Share Posted January 12, 2013 1- جربته ولا ضبط 2- وش فايدة ذا الكود setElementRotation 1- تأكد انك حققت الشرط هذا if wep == 3 and theWL >= 1 then 2- صعب علي التعبير ولكن هو يوجه شخصية اللاعب مثلاً يناظر الشمال و كذا Link to comment
Bhrany-danger Posted January 12, 2013 Share Posted January 12, 2013 عناد هذا اللي يخلي الاعب يناضر جهة معينة setPedRotation وهذا يدور العنصر مثل السيارة على ما اعتقد setElementRotation Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 1- جربته ولا ضبط 2- وش فايدة ذا الكود setElementRotation 1- تأكد انك حققت الشرط هذا if wep == 3 and theWL >= 1 then 2- صعب علي التعبير ولكن هو يوجه شخصية اللاعب مثلاً يناظر الشمال و كذا [2001-01-04 00:03:14] WARNING: attacker\server.lua:3: Bad argument @ 'getElementType' [Expected element at argument 1, got nil] [2001-01-04 00:03:27] ERROR: attacker\server.lua:16: attempt to call global 'setPedControlState' (a nil value) [2001-01-04 00:03:28] WARNING: attacker\server.lua:12: Bad argument @ 'setElementRotation' [Expected element at argument 1, got nil] Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 -- لم يتم التجربة addEventHandler ( "onPlayerDamage", root, function ( attacker, wep ) if getElementType ( attacker ) == "player" then theTeam = getPlayerTeam ( attacker ) theWL = getPlayerWantedLevel ( source ) if theTeam == getTeamFromName ( "police" ) then if wep == 3 and theWL >= 1 then if isTimer ( theTimer ) then killTimer ( theTimer ) end theTimer = setTimer ( function ( ) x, y, z = getElementRotation ( attacker ) setElementRotation ( source, x, y, z ) end , 500, 0 ) showCursor ( source, true ) setPedControlState ( source, "sprint", true ) end end end end ) مشرفنا عناد، كودك ذا ما يحط اللاعب مواجه للشرطي، لانه ماله علاقة زاوية الشرطي باتجاه اللاعب، لازم تجيب الزاوية من الميل بين نقطتين وثم تجيب الزاوية من الميل، ولحسن الحظ في كود جاهز يسوي عنك الحسبة هذي كلها + انت اضفت في كودك onPlayerDamage ---- سيرفر setPedControlState ---- كلينت وهذا هو التصحيح للكود، طبعا الكود مو كامل، على صاحب الموضوع انه يكمله مثل اذا هرب اللاعب او اذا طلع الشرطي او المجرم من السيرفر يلغي التايمر والا تصير اخطاءهذا هو الكود وعليك البقية يا صاحب الموضوع ذذ local timersT = {} function followFun ( attacker, wep ) if ( getElementType ( attacker ) == "player" ) then theTeam = getPlayerTeam ( attacker ) if ( theTeam == getTeamFromName ( "police" ) ) then local wep = getPedWeapon ( attacker ) local theWL = getPlayerWantedLevel ( source ) if ( wep == 3 ) and ( theWL > 0 ) then if ( isTimer ( timersT[source] ) ) then killTimer ( timersT[source] ) end timersT[source] = setTimer ( function ( ) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0 ) showCursor ( source, true ) setControlState ( source, "sprint", true ) end end end end addEventHandler ( "onPlayerDamage", root, followFun ) 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 ايضا تحتاج الى اضافة كود toggleControl لتعطيل القفز وغيره Link to comment
TAPL Posted January 12, 2013 Share Posted January 12, 2013 غير معرفين داخل التايمر attacker و source يا بسول Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 ما اظن، اظنهم معرفين ذذ اذا مو معرفين يعرفهم البطل صاحب الموضوع Link to comment
TAPL Posted January 12, 2013 Share Posted January 12, 2013 ما اظن، اظنهم معرفين ذذ اذا مو معرفين يعرفهم البطل صاحب الموضوع ذذ timersT[source] = setTimer ( function ( ) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0 ) لازم تعرفهم بالتايمر كذا timersT[source] = setTimer ( function (source, attacker) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0, source, attacker ) وذا ما له داعي لان يجي بالأفنت local wep = getPedWeapon ( attacker ) Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 ما اظن، اظنهم معرفين ذذ اذا مو معرفين يعرفهم البطل صاحب الموضوع ذذ timersT[source] = setTimer ( function ( ) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0 ) لازم تعرفهم بالتايمر كذا timersT[source] = setTimer ( function (source, attacker) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0, source, attacker ) وذا ما له داعي لان يجي بالأفنت local wep = getPedWeapon ( attacker ) مشكؤؤؤؤر تابل وبسول بجرب الكود ارد لكم خبر المهم عندي سؤال وش معنا هذاي الرموز ؟ > => Link to comment
Sora Posted January 12, 2013 Share Posted January 12, 2013 ما اظن، اظنهم معرفين ذذ اذا مو معرفين يعرفهم البطل صاحب الموضوع ذذ timersT[source] = setTimer ( function ( ) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0 ) لازم تعرفهم بالتايمر كذا timersT[source] = setTimer ( function (source, attacker) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0, source, attacker ) وذا ما له داعي لان يجي بالأفنت local wep = getPedWeapon ( attacker ) مشكؤؤؤؤر تابل وبسول بجرب الكود ارد لكم خبر المهم عندي سؤال وش معنا هذاي الرموز ؟ > => هذي رموز تستخدمها عشان تفرق بين الارقام .. == يساوي ~= لايساوي <= اقل من او يساوي >= اكبر من او يساوي < اقل من > اكبر من Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 هذي رموز تستخدمها عشان تفرق بين الارقام .. == يساوي ~= لايساوي <= اقل من او يساوي >= اكبر من او يساوي < اقل من > اكبر من مشكؤؤر سورا شباب الكود ماضبط هذا الكود بعد ماعدله تابل local timersT = {} function followFun ( attacker, wep ) if ( getElementType ( attacker ) == "player" ) then theTeam = getPlayerTeam ( attacker ) if ( theTeam == getTeamFromName ( "police" ) ) then local wep = getPedWeapon ( attacker ) local theWL = getPlayerWantedLevel ( source ) if ( wep == 3 ) and ( theWL > 0 ) then if ( isTimer ( timersT[source] ) ) then killTimer ( timersT[source] ) end timersT[source] = setTimer ( function (source, attacker) local x,y = getElementPosition( source ) local x1,y1 = getElementPosition( attacker ) local rot = findRotation(x,y,x1,y1) setElementRotation ( source, 0,0,rot ) end, 500, 0, source, attacker ) end end end end addEventHandler ( "onPlayerDamage", root, followFun ) 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
Bssol Posted January 12, 2013 Share Posted January 12, 2013 الى تابل بعد قلبي ذذ جرب هذا المثال ورد لي خبر function aaaa() local msg = "بسول" setTimer(function() outputChatBox(msg) end,1000,0) end aaaa() بالنسبة لك اخ سوسو جرب كودي الاول Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 الى تابل بعد قلبي ذذ جرب هذا المثال ورد لي خبر function aaaa() local msg = "بسول" setTimer(function() outputChatBox(msg) end,1000,0) end aaaa() بالنسبة لك اخ سوسو جرب كودي الاول [2001-01-04 01:02:58] WARNING: attacker\server.lua:4: Bad argument @ 'getElementType' [Expected element at argument 1, got nil] Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 بعدل سطر 4 بهذا if ( isElement(attacker) ) and ( getElementType ( attacker ) == "player" ) then Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 بعدل سطر 4 بهذا if ( isElement(attacker) ) and ( getElementType ( attacker ) == "player" ) then [2001-01-04 01:14:14] ERROR: attacker\server.lua:23: attempt to perform arithmetic on local 'x1' (a boolean value) [2001-01-04 01:14:14] WARNING: attacker\server.lua:13: Bad argument @ 'getElementPosition' [Expected element at argument 1, got nil] Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 هممممممم الخطأ اما ان اللاعب او الشرطي طلع من السيرفر او ان طريقتي في التعويض في التايمر خطأ جرب هذا مثال تابل بعد التعديل timersT[source] = setTimer ( function ( aaa,bbb ) if ( isElement(aaa) ) and ( isElement(bbb) ) then local x,y = getElementPosition( aaa ) local x1,y1 = getElementPosition( bbb ) local rot = findRotation(x,y,x1,y1) setElementRotation ( aaa, 0,0,rot ) end end, 500, 0, source,attacker ) Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 هممممممم الخطأ اما ان اللاعب او الشرطي طلع من السيرفر او ان طريقتي في التعويض في التايمر خطأ جرب هذا مثال تابل بعد التعديل timersT[source] = setTimer ( function ( aaa,bbb ) if ( isElement(aaa) ) and ( isElement(bbb) ) then local x,y = getElementPosition( aaa ) local x1,y1 = getElementPosition( bbb ) local rot = findRotation(x,y,x1,y1) setElementRotation ( aaa, 0,0,rot ) end end, 500, 0, source,attacker ) ما ضبط ع العموم مشكؤؤر بسول مالي مصلحه اسوي مود مو فاهم طريقته ! مشكؤؤؤر يغلق Link to comment
TAPL Posted January 12, 2013 Share Posted January 12, 2013 الى تابل بعد قلبي ذذ جرب هذا المثال ورد لي خبر function aaaa() local msg = "بسول" setTimer(function() outputChatBox(msg) end,1000,0) end aaaa() بالنسبة لك اخ سوسو جرب كودي الاول إلى بسول بعد قلبي ذذ جرب ذا المثال ورد لي خبر function aaaa() setTimer(function() outputChatBox(getPlayerName(source)) end,1000,0) end addEventHandler("onPlayerChat", root, aaaa) وبعد ما تجربه جرب المثال الثاني ورد لي خبر function aaaa() setTimer(function(source) outputChatBox(getPlayerName(source)) end,1000,0,source) end addEventHandler("onPlayerChat", root, aaaa) Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 مشكووور يا تابل يا بعد قلبي ذذ + يا سوسو، وش الي ما ضبط بالضبط؟؟؟ هل يوجد اخطاء؟؟اذا ما يوجد، وش يصير بالضبط؟ Link to comment
Bo7meeeD Posted January 12, 2013 Author Share Posted January 12, 2013 مشكووور يا تابل يا بعد قلبي ذذ + يا سوسو، وش الي ما ضبط بالضبط؟؟؟ هل يوجد اخطاء؟؟اذا ما يوجد، وش يصير بالضبط؟ والله ي بسول الكود انا ما فهمت وش اللي فيه زاوية ومدري شنو المهم انا مليت من الكود الصراححة الكود معقد يغلق... Link to comment
Bssol Posted January 12, 2013 Share Posted January 12, 2013 والله ي بسول الكود انا ما فهمت وش اللي فيهزاوية ومدري شنو المهم انا مليت من الكود الصراححة الكود معقد يغلق... جرب ذا، واعتبرها اخر محاولة ذذ اظنها تضبط وتخليه يمشي وراك، والباقي عليك local timersT = {} function followFun ( attacker, wep ) if ( isElement(attacker) ) and ( getElementType ( attacker ) == "player" ) then theTeam = getPlayerTeam ( attacker ) if ( theTeam ) and ( theTeam == getTeamFromName ( "police" ) ) then local theWL = getPlayerWantedLevel ( source ) if ( wep == 3 ) and ( theWL > 0 ) then if ( isTimer ( timersT[source] ) ) then killTimer ( timersT[source] ) end timersT[source] = setTimer ( function ( aaa,bbb ) if ( isElement(aaa) ) and ( isElement(bbb) ) then local x,y = getElementPosition( aaa ) local x1,y1 = getElementPosition( bbb ) local rot = findRotation(x,y,x1,y1) setElementRotation ( aaa, 0,0,rot ) end end, 500, 0, source,attacker ) setPedAnimation ( source,"ped","run_1armed",-1,true,true,false,false) end end end end addEventHandler ( "onPlayerDamage", root, followFun ) 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
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