Snakegold Posted August 31, 2018 Share Posted August 31, 2018 شباب بدي لما يكون ديموشن تبع اللاعب 1 ما يقدر يدخل للتيمات مرة ثانية function addtoteam (source) setElementData(resourceRoot,"any",math.random(0,1)) local Data = getElementData(resourceRoot,"any") if (Data == 1) then setElementPosition ( source, -1610.37890625 , -151.01559448242, 14.546875 ) setPlayerTeam(source,Team1) elseif (Data == 0) then setElementPosition ( source, 395.79275512695, 2534.6953125, 16.543769836426 ) setPlayerTeam(source,Team2) end end addCommandHandler('join', addtoteam) جربت هذا الكود if ( getElementDimension ( source ) == 1 ) then return end .... بس خربت كل شي Link to comment
Mr.Mostafa Posted August 31, 2018 Share Posted August 31, 2018 آشرح فكرة آلكود .. آلي تبيهآ . + جرب function addtoteam (source) setElementData(resourceRoot,"any",math.random(0,1)) local Data = getElementData(resourceRoot,"any") if (Data == 1) then if ( getElementDimension ( source ) == 1 ) then return end setElementPosition ( source, -1610.37890625 , -151.01559448242, 14.546875 ) setPlayerTeam(source,Team1) elseif (Data == 0) then if ( getElementDimension ( source ) == 1 ) then return end setElementPosition ( source, 395.79275512695, 2534.6953125, 16.543769836426 ) setPlayerTeam(source,Team2) end end addCommandHandler('join', addtoteam) Link to comment
Trefeor Posted August 31, 2018 Share Posted August 31, 2018 ليه تسوي داتا على الفاضي شوف هذا الكود local info = { [0] = { teamName = "Red" , pos = {0,0,3} } , [1] = { teamName = "Blue" , pos = {100,100,3} } , } addCommandHandler ( "join" , function ( Player ) local Random = math.random(0,1) if ( info [ Random ] and getElementDimension ( Player ) ~= 1 and getTeamFromName ( info[Random].teamName ) ) then setElementPosition ( Player , unpack(info[Random].pos) ) setPlayerTeam ( Player , getTeamFromName ( info[Random].teamName ) ) end end ) 2 Link to comment
Snakegold Posted August 31, 2018 Author Share Posted August 31, 2018 (edited) أيش بدي : لما يكون اللاعب داخل الأيفينت يعني ديموشن تبعه 1 فلما يكتب الكوماند الي بدخله للإيفنت ما يقدر لنو هو أصلا في الديومشن 1 لما حطيت الكود تبعك يا مصطفى صرت لما أكتب الكوماند بيروح للديموشن 1 بس ما يدخل اللاعب للتيم و لما أموت و أكتب الكوماند بيدخل للتيم و ديموشن 1 ليش؟ 13 hours ago, Trefeor said: ليه تسوي داتا على الفاضي شوف هذا الكود local info = { [0] = { teamName = "Red" , pos = {0,0,3} } , [1] = { teamName = "Blue" , pos = {100,100,3} } , } addCommandHandler ( "join" , function ( Player ) local Random = math.random(0,1) if ( info [ Random ] and getElementDimension ( Player ) ~= 1 and getTeamFromName ( info[Random].teamName ) ) then setElementPosition ( Player , unpack(info[Random].pos) ) setPlayerTeam ( Player , getTeamFromName ( info[Random].teamName ) ) end end ) كودك صعب ما اقدر اتعامل معه Edited August 31, 2018 by Snakegold Link to comment
فاّرس Posted August 31, 2018 Share Posted August 31, 2018 وضح نوعية التعامل؟ كل اللي عليك تعدل الجدول وتضيف الإحداثيات وإسم التيم فقط. وإذا بتضيف تيمات جديده سوي كذا : local info = { [0] = { teamName = "Red" , pos = {0,0,3} } , [1] = { teamName = "Blue" , pos = {100,100,3} } , [2] = { teamName = "Green", pos = { 0, 0, 0 } } } * الأفضل تخلي مفتاح الجدول يبدأ العد من الرقم 1 وأعلى عشان تقدر تعدل وظيفة جلب الرقم العشوائي بحيث تخلي أصغر قيمه صفر وأكبر قيمة عدد العناصر بالجدول local Random = math.random(0,#info) 1 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