SycroX Posted November 26, 2015 Share Posted November 26, 2015 السلام عليكم ابي اسوي Team اقدر افتحو و اغلقو بكومند يعني مثلا تيم للمسابقات ابي وقت ما اسوي مسابقة مثلا اكتب openTeam1 يفتح الفريق و الكل يقدر يختاره بعدها اقفلو مثلا بكومند closeTeam1 و بعدها ما حد يقدر يختارو شو الفانكشنات ؟ Link to comment
Rockyz Posted November 26, 2015 Share Posted November 26, 2015 Example : local Test = createTeam ( "Test", 0, 255, 0 ) -- isEventHandlerAdded [ BY iMr.Dawix~# ] function isEventHandlerAdded ( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function OpenTeam ( ) setElementData ( source, "ZZZ", false ) end function CloseTeam ( ) setElementData ( source, "ZZZ", true ) end addCommandHandler ( "OpenTheTeam", function ( ) for k, v in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( v, "ZZZ" ) == true ) then if not ( isEventHandlerAdded ( "onResourceStart", resourceRoot, CloseTeam ) ) then addEventHandler ( "onResourceStart", resourceRoot, OpenTeam ) else removeEventHandler ( "onResourceStart", resourceRoot, CloseTeam ) end end end end ) addCommandHandler ( "CloseTheTeam", function ( ) for k, v in ipairs ( getElementsByType ( "player" ) ) do if ( getElementData ( v, "ZZZ" ) == false ) then if not ( isEventHandlerAdded ( "onResourceStart", resourceRoot, OpenTeam ) ) then addEventHandler ( "onResourceStart", resourceRoot, CloseTeam ) else removeEventHandler ( "onResourceStart", resourceRoot, OpenTeam ) end end end end ) addCommandHandler ( "EnterTheTeam", function ( plr ) if ( getElementData ( plr, "ZZZ" ) == false ) then setPlayerTeam ( plr, Test ) else outputChatBox ( "You Cant Enter Sorry .", plr, 255, 0, 0, true ) end end ) Link to comment
SycroX Posted November 26, 2015 Author Share Posted November 26, 2015 مثالك به شي غلط :- اقدر ادخل التيم حتي و هو مقفول Link to comment
Ksa911-Mta Posted November 26, 2015 Share Posted November 26, 2015 يا احمد ممكن الشسكايب حقك ؟ Link to comment
The Don Posted November 26, 2015 Share Posted November 26, 2015 (edited) EDITED POST شكرا على المعلومه طابل وي صاحب الموضوع المثال يصير كذا serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled if not isElement(team) then outputChatBox("he started the fappin wars!",root,255,255,0) team = createTeam ("fap team",255,255,0) end elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled if isElement(team) then outputChatBox("he stopped the fappin wars!",root,255,0,0) destroyElement(team) end elseif cmd == "joinfap" and isElement(team) then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",root,255,255,0) elseif cmd == "quitfap" and isElement(team) then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",root,255,255,0) end end ) Edited November 26, 2015 by Guest Link to comment
SycroX Posted November 26, 2015 Author Share Posted November 26, 2015 مثال اتمنى تفهمه serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled setElementData(root,"CanJoin",true) outputChatBox("he started the fappin wars!",root,255,255,0) team = createTeam ("fap team",255,255,0) elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled setElementData(root,"CanJoin",false) outputChatBox("he stoped the fappin wars!",root,255,0,0) destroyElement(team) elseif cmd == "joinfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",root,255,255,0) elseif cmd == "quitfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",root,255,255,0) end end ) مشكور فهمت الحين الفكرة + وش فانكشن يخلي اقصي عدد لاعبين فلتيم مثلا 10 Link to comment
TAPL Posted November 26, 2015 Share Posted November 26, 2015 مثال اتمنى تفهمه serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled setElementData(root,"CanJoin",true) outputChatBox("he started the fappin wars!",root,255,255,0) team = createTeam ("fap team",255,255,0) elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled setElementData(root,"CanJoin",false) outputChatBox("he stoped the fappin wars!",root,255,0,0) destroyElement(team) elseif cmd == "joinfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",root,255,255,0) elseif cmd == "quitfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",root,255,255,0) end end ) الألمنت داتا على الروت و التحقق من الداتا على السورس Link to comment
The Don Posted November 26, 2015 Share Posted November 26, 2015 على حسب علمي ان الروت يصير لكل الاعبين , عشان لما يسوي الكومند يصير كل الناس true والتحقق السورس لانه الاعب نفسه صحح كلامي لو طلعت غلط + مثال اتمنى تفهمه serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled setElementData(root,"CanJoin",true) outputChatBox("he started the fappin wars!",root,255,255,0) team = createTeam ("fap team",255,255,0) elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled setElementData(root,"CanJoin",false) outputChatBox("he stoped the fappin wars!",root,255,0,0) destroyElement(team) elseif cmd == "joinfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",root,255,255,0) elseif cmd == "quitfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",root,255,255,0) end end ) مشكور فهمت الحين الفكرة + وش فانكشن يخلي اقصي عدد لاعبين فلتيم مثلا 10 countPlayersInTeam Link to comment
TAPL Posted November 26, 2015 Share Posted November 26, 2015 على حسب علمي ان الروت يصير لكل الاعبين والتحقق السورس لانه الاعب نفسه صحح كلامي لو طلعت غلط غير صحيح التابعين له children الروت يعتبر المنت و لما تحط داتا على الروت الداتا يبقى على المنت الروت و ما يأثر على الـ Link to comment
Rockyz Posted November 26, 2015 Share Posted November 26, 2015 على حسب علمي ان الروت يصير لكل الاعبين , عشان لما يسوي الكومند يصير كل الناس trueوالتحقق السورس لانه الاعب نفسه صحح كلامي لو طلعت غلط + مثال اتمنى تفهمه serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled setElementData(root,"CanJoin",true) outputChatBox("he started the fappin wars!",root,255,255,0) team = createTeam ("fap team",255,255,0) elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled setElementData(root,"CanJoin",false) outputChatBox("he stoped the fappin wars!",root,255,0,0) destroyElement(team) elseif cmd == "joinfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",root,255,255,0) elseif cmd == "quitfap" and getElementData(source,"CanJoin") == true then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",root,255,255,0) end end ) مشكور فهمت الحين الفكرة + وش فانكشن يخلي اقصي عدد لاعبين فلتيم مثلا 10 countPlayersInTeam الروت هو يجلب جميع الالمنتات وليس فقط الاعبين serial = "xxxx" addEventHandler("onPlayerCommand", root, function ( cmd ) for key, value in ipairs ( getElementsByType ( "player" ) ) do if cmd == "startfappin" and getPlayerSerial(source) == serial then -- enabled setElementData(value,"CanJoin",true) outputChatBox("he started the fappin wars!",value,255,255,0) team = createTeam ("fap team",255,255,0) elseif cmd == "stopfappin" and getPlayerSerial(source) == serial then -- disabled setElementData(value,"CanJoin",false) outputChatBox("he stoped the fappin wars!",value,255,0,0) destroyElement(team) elseif cmd == "joinfap" and getElementData(value,"CanJoin") == true then setPlayerTeam(source,team) outputChatBox(""..getPlayerName(source).." he joined the war lel",value,255,255,0) elseif cmd == "quitfap" and getElementData(value,"CanJoin") == true then setPlayerTeam(source,nil) outputChatBox(""..getPlayerName(source).." he quited the war lel",value,255,255,0) end end end ) Link to comment
</Mr.Tn6eL> Posted November 26, 2015 Share Posted November 26, 2015 (edited) الروت عبارة عن المنت رئيسي يتفرع اليه الالمنتات الاخرى مثل player, marker, resource, الخ.. فعشان كذا سموها element tree Edited November 26, 2015 by Guest Link to comment
The Don Posted November 26, 2015 Share Posted November 26, 2015 احس اني صرت صاحب الموضوع شكرا على المعلومات كل نفر + تم تعديل الكود في اول رد Link to comment
TAPL Posted November 26, 2015 Share Posted November 26, 2015 يفترض تحط الداتا على المنت الروت مو اللاعب، لان لو لاعب جديد خش السيرفر ما رح يكون معه الداتا 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