Mhmd.z Posted April 4, 2016 Posted April 4, 2016 تصحيح كود يجيب عدد الاعبين يلي معهم داتا عن طريق الجدول, الديبق ما فيه اخطاء.... playersTable = {} function onRStart() outputChatBox("Start", getRootElement(), 255, 255, 255, true) timer1 = setTimer(function() for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "playersInMission") then table.insert(playersTable, v) if #playersTable < 3 then outputChatBox("No Players In The Mission", getRootElement(), 255, 255, 255, true) else outputChatBox("Have Players In The Mission", getRootElement(), 255, 255, 255, true) end end end end, 5000, 1) end addEventHandler("onResourceStart", resourceRoot, onRStart)
Me[Z]oO Posted April 4, 2016 Posted April 4, 2016 playersTable = {} function onRStart() outputChatBox("Start", getRootElement(), 255, 255, 255, true) timer1 = setTimer(function() for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "playersInMission") == true then table.insert(playersTable, v) if #playersTable < 3 then outputChatBox("No Players In The Mission", getRootElement(), 255, 255, 255, true) else outputChatBox("Have Players In The Mission", getRootElement(), 255, 255, 255, true) end end end end, 5000, 1) end addEventHandler("onResourceStart", resourceRoot, onRStart) مانك متحقق من الداتا true or false Skype :- mezo.prince1 FaceBook :- https://www.facebook.com/medolua YouTube :- http://www.youtube.com/c/MeZoOPriNse
Jupi Posted April 4, 2016 Posted April 4, 2016 playersTable = {} function onRStart() outputChatBox("Start", getRootElement(), 255, 255, 255, true) timer1 = setTimer(function() for i,v in ipairs(getElementsByType("player")) do if getElementData(v, "playersInMission") == true then table.insert(playersTable, v) if #playersTable < 3 then outputChatBox("No Players In The Mission", getRootElement(), 255, 255, 255, true) else outputChatBox("Have Players In The Mission", getRootElement(), 255, 255, 255, true) end end end end, 5000, 1) end addEventHandler("onResourceStart", resourceRoot, onRStart) مانك متحقق من الداتا true or false مش لازم .
Me[Z]oO Posted April 4, 2016 Posted April 4, 2016 وش تبي تسوي بلضبط Skype :- mezo.prince1 FaceBook :- https://www.facebook.com/medolua YouTube :- http://www.youtube.com/c/MeZoOPriNse
Mhmd.z Posted April 4, 2016 Author Posted April 4, 2016 تصحيح كود يجيب عدد الاعبين يلي معهم داتا عن طريق الجدول, الديبق ما فيه اخطاء....
HassoN Posted April 4, 2016 Posted April 4, 2016 عدلت لك الكود كامل ، جرب function onRStart() outputChatBox("Start", getRootElement(), 255, 255, 255, true) timer1 = setTimer(function() if getHowManyPlayersInMission() < 3 then outputChatBox("No Players In The Mission", getRootElement(), 255, 255, 255, true) else outputChatBox("Have Players In The Mission", getRootElement(), 255, 255, 255, true) end end, 5000, 1) end addEventHandler("onResourceStart", resourceRoot, onRStart) function getHowManyPlayersInMission() plrs = 0 for _, player in ipairs(getElementsByType("player")) do if getElementData(player,"playersInMission") then plrs = plrs + 1 end end return plrs end أعتذر اذا فيه اخطاء ، جالس اكتب من الجوال * There is No God but Allah discord: HassoN#2709 Visit my wiki profile: https://wiki.multitheftauto.com/wiki/User:Hassan_saad
nxFairlywell Posted April 4, 2016 Posted April 4, 2016 إستخدم هذا الكود عشان تجيب اللاعبين اللي بالداتا المحدده أسهل لك و أفضل وإذا مافهمت الوظيفة علمني setElementData( player, "DataName", true ) -- لما يدخل اللاعب للمهمة setElementData( player, "DataName", false ) -- لما يطلع اللاعب من المهمة -- Syntax : getPlayersFromData( string data ) function getPlayersFromData( data ) if type(data) == "string" then local t = { } local players = getElementsByType("player") for _, i in ipairs( players ) do if ( getElementData(i,data) == true ) then table.insert( t, i ) end end return t else return outputDebugString("Bad Argument @ data , got "..tostring(type(data)), 2) end end -- مثال على إستخدام الوظيفة setTimer( function() for k, v in ipairs( getPlayersFromData("DataName") ) do outputChatBox(getPlayerName(v)) end end, 2000, 0) Discord ID : nxFairlywell#6895
Mhmd.z Posted April 5, 2016 Author Posted April 5, 2016 متأخرين كثير صراحه... زمان سويته خليت انه يحط الاعب بالجدول جبت عدد الاعبين يلي بالجدول
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