mr.Extreme Posted January 16, 2014 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 وشكرا
3NAD Posted January 16, 2014 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
mr.Extreme Posted January 16, 2014 Author 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 الاكواد زبط بس الوان فريق ما زبط
mr.Extreme Posted January 16, 2014 Author 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 الاكواد زبط بس الوان فريق ما زبط شباااب بدي حل الاكواد زبط بس الوان فريق ما زبط
TAPL Posted January 16, 2014 Posted January 16, 2014 /debugscript 3 + صورة للمشكلة لان ما فهمت وش تقصد بألوان الفريق
mr.Extreme Posted January 16, 2014 Author Posted January 16, 2014 /debugscript 3+ صورة للمشكلة لان ما فهمت وش تقصد بألوان الفريق لما انضم فريق لونة احمر بس ما يظهر لون احمر بيظهر الوان عادي
TAPL Posted January 16, 2014 Posted January 16, 2014 في الشات ولا في تاب ولا وين بالضبط + انت حاط الأعدادات في الميتا؟
mr.Extreme Posted January 16, 2014 Author Posted January 16, 2014 في الشات ولا في تاب ولا وين بالضبط+ انت حاط الأعدادات في الميتا؟ في سكور وشات ورادار
TAPL Posted January 16, 2014 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 )
3ssol Posted January 17, 2014 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 طيب وش الفايده من هل حركه ماني فاهمها
jafar Posted January 17, 2014 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 طيب وش الفايده من هل حركه ماني فاهمها عشان تحذف القيمة المحفوظة داخل الجدول
TAPL Posted January 17, 2014 Posted January 17, 2014 هذا السطر عشان يحذف القيمة من التيبل blip[source] = nil إذا ما حدفتها راح تبقى في التيبل و راح يكبر حجم التيبل تسبب لك مشاكل مع مرور الوقت بحيث ان اليوزر داتا مع مرور الوقت راح يكون متشابه و هنا تبدأ المشاكل إضافة إلى ان استهلاك الرامات راح يكون اعلى بسبب كبر حجم التيبل مع مرور الوقت
3ssol Posted January 17, 2014 Posted January 17, 2014 اها طيب عندي سوال اخير الي هو ليه ماحطيته مع كود حذف السياره ؟؟ انت مسوي تحقق اذا السياره موجوده يحذفه طيب ليه ماسويت معه بنفس التحقق حذف القيمه كودك الي فوق اذا الاعب ماعنده سياره بيحذف القيمه كيف يحذف القيمه ومافيه سياره اصلن ؟؟ مو المفروض يكون كذا ؟ 3.addEventHandler ( "onPlayerQuit", root, function ( ) if isElement(blip[source]) then destroyElement(blip[source]) blip[source] = nil end end)
TAPL Posted January 17, 2014 Posted January 17, 2014 هو الأثنين صح بس ما انحذف من التيبل element tree علشان لو البلب انحذف من الـ isElement انا تعمدت احط سطر حذف القيمة من التيبل خارج تحقق الفنكشن ما راح تكون فيه مشاكل لان حتى لو ما كان الألمنت موجود راح يحذف القيمة لما يخرج اللاعب من السيرفر
3ssol Posted January 17, 2014 Posted January 17, 2014 الي ماني فاهمه هو كيف تحذف قيمة والاعب بل اسأس يعني ماعنده سياره اعتقد راح يطلع خطأ ب الديبق او يمكن يحذف قيمة شخص ثاني معه سياره معليش يعني بس هاذي ماني فاهمها تحذف قيمة والاعب ماعنده سياره
mr.Extreme Posted January 17, 2014 Author 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
3ssol Posted January 17, 2014 Posted January 17, 2014 ي اخوان يليت واحد يشرحها لي مافهمتها blip[source] = nil
TAPL Posted January 17, 2014 Posted January 17, 2014 ي اخوان يليت واحد يشرحها لي مافهمتها blip[source] = nil هذا يحذف القيمة من التيبل يعني نفس الفنكشن هذا table.remove
3ssol Posted January 17, 2014 Posted January 17, 2014 table.remove بس هذا الفنكشن لما يحذف لازم تكون ضايف الاعب للجدول عشان تحذفه اما هاذي blip[source] = nil انت تحذف القيمة والاعب ماعنده سياره كيف ؟؟؟ هاذي القيمه ماتصير الا اذا طلعت سياره وانت مومطلع سياره وتحذفها لحست مخي
#DRAGON!FIRE Posted January 17, 2014 Posted January 17, 2014 (edited) table.remove بس هذا الفنكشن لما يحذف لازم تكون ضايف الاعب للجدول عشان تحذفهاما هاذي blip[source] = nil انت تحذف القيمة والاعب ماعنده سياره كيف ؟؟؟ هاذي القيمه ماتصير الا اذا طلعت سياره وانت مومطلع سياره وتحذفها لحست مخي من قلك الجدول للاعب ولأ لسيارة .. هو مسوي البلب على اللاعب .. وشال اللاعب من الجدول Edited January 17, 2014 by Guest
3NAD Posted January 17, 2014 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 و تشيك مرة ثانية على التيبل
3ssol Posted January 17, 2014 Posted January 17, 2014 blip[source] = تعني الاعب ؟ بس هو كيف مسويها باسم البلب ؟
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