mr.Extreme Posted January 16, 2014 Share Posted January 16, 2014 اسلام عليكم شبااب وين الخطأ هنا ؟؟؟؟؟ local lowerBound,upperBound = unpack(get"color_range") g_Root = getRootElement () g_ResourceRoot = getResourceRootElement ( getThisResource () ) addEventHandler ( "onResourceStart", g_ResourceRoot, function() for i,player in ipairs(getElementsByType"player") do processPlayer ( player ) end end ) function processPlayer ( player ) if not isElement(blip) then blip = createBlipAttachedTo(source) end local theTeam = getPlayerTeam(source) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(source, r, g, b) setBlipColor(blip, r, g, b, 255) else --[[if not isElement(blip1[source]) then blip1[source] = createBlipAttachedTo(source) end]] player = player or source local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) --setBlipColor(blip1[source], rr, gg, bb, 255) --destroyElement(blip[source]) end end addEventHandler ( "onPlayerLogin", getRootElement(), processPlayer ) function setColorPlayer() if not isElement(blips) then blips = createBlipAttachedTo(source) end player = player or source local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blips, rr, gg, bb, 255) end addEventHandler("onPlayerJoin", getRootElement(), setColorPlayer) function ifnottheteam() local theTeams = getPlayerTeam(source) if not theTeams then destroyElement(blip) end if theTeams then destroyElement(blips) end end addEventHandler("onPlayerLogin", getRootElement(), ifnottheteam) addEventHandler("onPlayerQuit", root, function() if isElement(blip) then destroyElement(blip) destroyElement(blips) end end ) --[[ addEventHandler('onPlayerChat', g_Root, function(msg, type) if type == 0 then cancelEvent() local r, g, b = getPlayerColor(source) local name = getPlayerName(source) local msg = msg:gsub('#%x%x%x%x%x%x', '') outputChatBox( name.. ': #FFFFFF' .. msg, g_Root, r, g, b, true) outputServerLog( "CHAT: " .. name .. ": " .. msg ) end end ) ]] getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor وشكرا Link to comment
3NAD Posted January 16, 2014 Share Posted January 16, 2014 local lowerBound, upperBound = unpack(get"color_range") blip = { }; addEventHandler ( "onResourceStart", resourceRoot, function() for i, player in ipairs ( getElementsByType ( "player" ) ) do processPlayer ( player ) end end ) function processPlayer ( player ) local player = player or source if not isElement(blip[player]) then blip[player] = createBlipAttachedTo(player) end local theTeam = getPlayerTeam(player) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(player, r, g, b) setBlipColor(blip[player], r, g, b, 255) else local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blip[player], rr, gg, bb, 255) end end addEventHandler ( "onPlayerLogin", root, processPlayer ) addEventHandler ( "onPlayerJoin", root, function ( ) processPlayer ( source ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end end ) getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor Link to comment
mr.Extreme Posted January 16, 2014 Author Share Posted January 16, 2014 local lowerBound, upperBound = unpack(get"color_range") blip = { }; addEventHandler ( "onResourceStart", resourceRoot, function() for i, player in ipairs ( getElementsByType ( "player" ) ) do processPlayer ( player ) end end ) function processPlayer ( player ) local player = player or source if not isElement(blip[player]) then blip[player] = createBlipAttachedTo(player) end local theTeam = getPlayerTeam(player) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(player, r, g, b) setBlipColor(blip[player], r, g, b, 255) else local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blip[player], rr, gg, bb, 255) end end addEventHandler ( "onPlayerLogin", root, processPlayer ) addEventHandler ( "onPlayerJoin", root, function ( ) processPlayer ( source ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end end ) getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor الاكواد زبط بس الوان فريق ما زبط Link to comment
mr.Extreme Posted January 16, 2014 Author Share Posted January 16, 2014 local lowerBound, upperBound = unpack(get"color_range") blip = { }; addEventHandler ( "onResourceStart", resourceRoot, function() for i, player in ipairs ( getElementsByType ( "player" ) ) do processPlayer ( player ) end end ) function processPlayer ( player ) local player = player or source if not isElement(blip[player]) then blip[player] = createBlipAttachedTo(player) end local theTeam = getPlayerTeam(player) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(player, r, g, b) setBlipColor(blip[player], r, g, b, 255) else local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blip[player], rr, gg, bb, 255) end end addEventHandler ( "onPlayerLogin", root, processPlayer ) addEventHandler ( "onPlayerJoin", root, function ( ) processPlayer ( source ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end end ) getPlayerColor = getPlayerNametagColor getPlayerColour = getPlayerNametagColor الاكواد زبط بس الوان فريق ما زبط شباااب بدي حل الاكواد زبط بس الوان فريق ما زبط Link to comment
TAPL Posted January 16, 2014 Share Posted January 16, 2014 /debugscript 3 + صورة للمشكلة لان ما فهمت وش تقصد بألوان الفريق Link to comment
mr.Extreme Posted January 16, 2014 Author Share Posted January 16, 2014 /debugscript 3+ صورة للمشكلة لان ما فهمت وش تقصد بألوان الفريق لما انضم فريق لونة احمر بس ما يظهر لون احمر بيظهر الوان عادي Link to comment
TAPL Posted January 16, 2014 Share Posted January 16, 2014 في الشات ولا في تاب ولا وين بالضبط + انت حاط الأعدادات في الميتا؟ Link to comment
mr.Extreme Posted January 16, 2014 Author Share Posted January 16, 2014 في الشات ولا في تاب ولا وين بالضبط+ انت حاط الأعدادات في الميتا؟ في سكور وشات ورادار Link to comment
TAPL Posted January 16, 2014 Share Posted January 16, 2014 جرب ذا local lowerBound, upperBound = unpack(get("color_range")) blip = { }; addEventHandler ( "onResourceStart", resourceRoot, function() for i, player in ipairs ( getElementsByType ( "player" ) ) do processPlayer ( player ) end end ) function processPlayer(player) local player = source or player setTimer(function(player) if not isElement(blip[player]) then blip[player] = createBlipAttachedTo(player) end local theTeam = getPlayerTeam(player) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(player, r, g, b) setBlipColor(blip[player], r, g, b, 255) else local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blip[player], rr, gg, bb, 255) end end, 3000, 1, player) end addEventHandler ( "onPlayerLogin", root, processPlayer ) addEventHandler ( "onPlayerJoin", root, processPlayer ( source ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end blip[source] = nil end ) Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 جرب ذا blip = { }; addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end blip[source] = nil -- here end ) تابل شوف الي انا حاط عندها كلمة here انا دايم اشوف يحطونها اذا كنت مسوي جدول لو انا مسوي جدول سيارات وابي اسوي سحب لسياره لازم احط كذا mycar[source] = nil طيب وش الفايده من هل حركه ماني فاهمها Link to comment
jafar Posted January 17, 2014 Share Posted January 17, 2014 جرب ذا blip = { }; addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end blip[source] = nil -- here end ) تابل شوف الي انا حاط عندها كلمة here انا دايم اشوف يحطونها اذا كنت مسوي جدول لو انا مسوي جدول سيارات وابي اسوي سحب لسياره لازم احط كذا mycar[source] = nil طيب وش الفايده من هل حركه ماني فاهمها عشان تحذف القيمة المحفوظة داخل الجدول Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 هذا السطر عشان يحذف القيمة من التيبل blip[source] = nil إذا ما حدفتها راح تبقى في التيبل و راح يكبر حجم التيبل تسبب لك مشاكل مع مرور الوقت بحيث ان اليوزر داتا مع مرور الوقت راح يكون متشابه و هنا تبدأ المشاكل إضافة إلى ان استهلاك الرامات راح يكون اعلى بسبب كبر حجم التيبل مع مرور الوقت Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 اها طيب عندي سوال اخير الي هو ليه ماحطيته مع كود حذف السياره ؟؟ انت مسوي تحقق اذا السياره موجوده يحذفه طيب ليه ماسويت معه بنفس التحقق حذف القيمه كودك الي فوق اذا الاعب ماعنده سياره بيحذف القيمه كيف يحذف القيمه ومافيه سياره اصلن ؟؟ مو المفروض يكون كذا ؟ 3.addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) blip[source] = nil end end) Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 هو الأثنين صح بس ما انحذف من التيبل element tree علشان لو البلب انحذف من الـ isElement انا تعمدت احط سطر حذف القيمة من التيبل خارج تحقق الفنكشن ما راح تكون فيه مشاكل لان حتى لو ما كان الألمنت موجود راح يحذف القيمة لما يخرج اللاعب من السيرفر Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 الي ماني فاهمه هو كيف تحذف قيمة والاعب بل اسأس يعني ماعنده سياره اعتقد راح يطلع خطأ ب الديبق او يمكن يحذف قيمة شخص ثاني معه سياره معليش يعني بس هاذي ماني فاهمها تحذف قيمة والاعب ماعنده سياره Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 ما راح يطلع خطأ ولا شي جربها بنفسك و شوف Link to comment
mr.Extreme Posted January 17, 2014 Author Share Posted January 17, 2014 جرب ذا local lowerBound, upperBound = unpack(get("color_range")) blip = { }; addEventHandler ( "onResourceStart", resourceRoot, function() for i, player in ipairs ( getElementsByType ( "player" ) ) do processPlayer ( player ) end end ) function processPlayer(player) local player = source or player setTimer(function(player) if not isElement(blip[player]) then blip[player] = createBlipAttachedTo(player) end local theTeam = getPlayerTeam(player) if theTeam then local r, g, b = getTeamColor(theTeam) setPlayerNametagColor(player, r, g, b) setBlipColor(blip[player], r, g, b, 255) else local rr, gg, bb = math.random(lowerBound, upperBound), math.random(lowerBound, upperBound), math.random(lowerBound, upperBound) setPlayerNametagColor(player, rr, gg, bb) setBlipColor(blip[player], rr, gg, bb, 255) end end, 3000, 1, player) end addEventHandler ( "onPlayerLogin", root, processPlayer ) addEventHandler ( "onPlayerJoin", root, processPlayer ( source ) end ) addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) end blip[source] = nil end ) اخر مشكلة طبعا ما في حد بسيرفر ألا انا http://im35.gulfup.com/H3P5r.png Link to comment
mr.Extreme Posted January 17, 2014 Author Share Posted January 17, 2014 انت نسيت الفنكشن في سطر 32 Link to comment
al-Kobra Posted January 17, 2014 Share Posted January 17, 2014 انت نسيت الفنكشن في سطر 32 انزين انت حطه Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 ي اخوان يليت واحد يشرحها لي مافهمتها blip[source] = nil Link to comment
TAPL Posted January 17, 2014 Share Posted January 17, 2014 ي اخوان يليت واحد يشرحها لي مافهمتها blip[source] = nil هذا يحذف القيمة من التيبل يعني نفس الفنكشن هذا table.remove Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 table.remove بس هذا الفنكشن لما يحذف لازم تكون ضايف الاعب للجدول عشان تحذفه اما هاذي blip[source] = nil انت تحذف القيمة والاعب ماعنده سياره كيف ؟؟؟ هاذي القيمه ماتصير الا اذا طلعت سياره وانت مومطلع سياره وتحذفها لحست مخي Link to comment
#DRAGON!FIRE Posted January 17, 2014 Share Posted January 17, 2014 (edited) table.remove بس هذا الفنكشن لما يحذف لازم تكون ضايف الاعب للجدول عشان تحذفهاما هاذي blip[source] = nil انت تحذف القيمة والاعب ماعنده سياره كيف ؟؟؟ هاذي القيمه ماتصير الا اذا طلعت سياره وانت مومطلع سياره وتحذفها لحست مخي من قلك الجدول للاعب ولأ لسيارة .. هو مسوي البلب على اللاعب .. وشال اللاعب من الجدول Edited January 17, 2014 by Guest Link to comment
3NAD Posted January 17, 2014 Share Posted January 17, 2014 جرب تشيل السيارة if isElement(blip[source]) then destroyElement(blip[source]) end ثم تشيك على التيبل addCommandHandler ( "check", function ( player ) if blip[player] then outputChatBox ( "Data Found" ) else outputChatBox ( "Lost" ) end end ) و لما تسوي كذا blip[source] = nil و تشيك مرة ثانية على التيبل Link to comment
3ssol Posted January 17, 2014 Share Posted January 17, 2014 blip[source] = تعني الاعب ؟ بس هو كيف مسويها باسم البلب ؟ 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