Mohamed Posted January 3, 2015 Share Posted January 3, 2015 السلام عليكم و رحمة الله تعالى و بركاته شباب بدي كود او فنكش تحديد كم من واحد يدخل في المهمة يعني ابي اكثر حد يدخلو المهمة 40 وشكر Link to comment
#DRAGON!FIRE Posted January 3, 2015 Share Posted January 3, 2015 local table = { }; table.insert ( table, player ) Link to comment
#DRAGON!FIRE Posted January 3, 2015 Share Posted January 3, 2015 فالنفترض دخول المهمة من عبر الماركر : local table = { }; addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) if ( getElementType ( element ) == "player" ) then table.insert ( table, element ) end end ) مجرد مثال بسيط لو فهمت الطريقة تقدر تسويه ع كودكـ لو حسيت انها صعبة .. بامكانكـ استخدام التيم . Link to comment
Mohamed Posted January 3, 2015 Author Share Posted January 3, 2015 يعني كيف احط كم من لاعب يدخل وين احط الرقم Link to comment
shwaeki Posted January 3, 2015 Share Posted January 3, 2015 local table = { }; addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) if ( getElementType ( element ) == "player" ) then table.insert ( table, element ) outputChatBox("Player In Mission "..#table,element,0,255,0) end end ) Link to comment
Mohamed Posted January 3, 2015 Author Share Posted January 3, 2015 وين احط كم من لاعب يقدر يدخل Link to comment
#DRAGON!FIRE Posted January 3, 2015 Share Posted January 3, 2015 طبعا كل ما يخرج من المهمة تشيله من التيبل table [ player ] = nil وع حسب كودكـ تسوي تحقق من الاعبين if ( #table == 25 ) then return "players full" end Link to comment
shwaeki Posted January 3, 2015 Share Posted January 3, 2015 local table = { }; local MaxPlayer = 5 addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) if ( getElementType ( element ) == "player" ) then if #table <= MaxPlayer then table.insert ( table, element ) outputChatBox("Player In Mission "..#table,element,0,255,0) end end end ) Link to comment
#DRAGON!FIRE Posted January 3, 2015 Share Posted January 3, 2015 local table = { }; local MaxPlayer = 5 addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) if ( getElementType ( element ) == "player" ) then if #table <= MaxPlayer then table.insert ( table, element ) outputChatBox("Player In Mission "..#table,element,0,255,0) end end end ) عندكـ خطا بسيط بالتحقق من العدد .. التحقق اذا يساوي او اقل من 5 يعني لو كان 5 راح يدخله = فـ شيل علامة الـ Link to comment
shwaeki Posted January 3, 2015 Share Posted January 3, 2015 ^ مشكور على التنبيه صاحب الموضوع هيك لو طلع الاعب يشيله من المهمه local table = { }; local MaxPlayer = 5 addEventHandler ( "onMarkerHit", resourceRoot, function ( element ) if ( getElementType ( element ) == "player" ) then if #table < MaxPlayer then table.insert ( table, element ) outputChatBox("Player In Mission "..#table,element,0,255,0) else outputChatBox("Mission is Full maximum number of players is "..MaxPlayer,element,0,255,0) end end end ) addEventHandler("onPlayerWasted", root, function() if table [ source ] then table [ source ] = nil end end) addEventHandler("onPlayerQuit", root, function() if table [ source ] then table [ source ] = nil end 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