z24d Posted October 13, 2015 Share Posted October 13, 2015 addCommandHandler( "LEVELALL", function( player, _, XP ) local PlayerAccount = getPlayerAccount( player ) if not ( isGuestAccount( PlayerAccount ) ) then if ( XP ) and ( tonumber( XP ) ) and ( isObjectInACLGroup( "user."..getAccountName( PlayerAccount ), aclGetGroup( "Console" ) ) ) then for _, Player in ipairs( getElementsByType( "player" ) ) do setElementData(Player, "experience", getElementData(player,"experience") + tonumber( XP ) ) exports.guimessages:outputServer( root, getPlayerName( player ).." #FFFF00Has Been Give all XP!!#FFFFCC[#00FF00".. tonumber( XP ) .."#FFFFCC]", 255, 255, 0 ) end end end end ) الرسالة تتكرر علا عدد الاعبين ليش؟ Link to comment
#Wizard Posted October 13, 2015 Share Posted October 13, 2015 انت حاط لكل لاعب يرسل رسالة روت عدل exports.guimessages:outputServer( root, getPlayerName( player ).." #FFFF00Has Been Give all XP!!#FFFFCC[#00FF00".. tonumber( XP ) .."#FFFFCC]", 255, 255, 0 ) الى exports.guimessages:outputServer( Player, getPlayerName( player ).." #FFFF00Has Been Give all XP!!#FFFFCC[#00FF00".. tonumber( XP ) .."#FFFFCC]", 255, 255, 0 ) Link to comment
` Allawi Posted October 13, 2015 Share Posted October 13, 2015 عشان انت حاط الرسالة مع الجدول فهو راح يكرر على حسب بيانات الجدول مثال بسيط وتوضيحي لتكرار الرسالة على حسب بيانات الجدول players = { "1", "2", "3", "4", "5", "6", "7", } addCommandHandler("example", function() for index,player in ipairs(players) do outputChatBox("Example Players: "..index,root,255,255,255,true) end end ) طيب انا كيف اتجنب التكرار راح استخدم الطريقه التاليه لتجنب التكرار players = { "1", "2", "3", "4", "5", "6", "7", } addCommandHandler("example", function() for index,player in ipairs(players) do -- You are code end outputChatBox("Example Players: 7",root,255,255,255,true) end ) وايضا انت مستخدم getElementsByType("player") هذي الوظيفة تجيب لك الالمنتات المطلوبه والالمنت المطلوب عندنا هو اللاعب ولذلك الرسالة كانت تكرر على عدد اللاعبين Link to comment
z24d Posted October 14, 2015 Author Share Posted October 14, 2015 function aAction ( type, action, admin, player, data, more ) if ( aLogMessages[type] ) then function aStripString ( string ) string = tostring ( string ) string = string.gsub ( string, "$admin", getPlayerName ( admin ) ) string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin ) and "" or " by " .. getPlayerName ( admin ) ) string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or " by " .. getPlayerName ( admin ) ) string = string.gsub ( string, "$data2", more or "" ) if ( player ) then string = string.gsub ( string, "$player", getPlayerName ( player ) ) end return tostring ( string.gsub ( string, "$data", data or "" ) ) end local node = aLogMessages[type][action] if ( node ) then local r, g, b = node["r"], node["g"], node["b"] if ( node["all"] ) then exports["guimessages"]:outputServer (_root, aStripString ( node["all"] ), r, g, b ) end if ( node["admin"] ) and ( admin ~= player ) then exports["guimessages"]:outputServer ( admin,aStripString ( node["admin"] ), r, g, b ) end if ( node["player"] ) then exports["guimessages"]:outputServer ( player,aStripString ( node["player"] ), r, g, b ) end if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end end end end وين الغلط تكفون ردو بسرعة Link to comment
ALw7sH Posted October 15, 2015 Share Posted October 15, 2015 function aAction ( type, action, admin, player, data, more ) if ( aLogMessages[type] ) then function aStripString ( string ) string = tostring ( string ) string = string.gsub ( string, "$admin", getPlayerName ( admin ) ) string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin ) and "" or " by " .. getPlayerName ( admin ) ) string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or " by " .. getPlayerName ( admin ) ) string = string.gsub ( string, "$data2", more or "" ) if ( player ) then string = string.gsub ( string, "$player", getPlayerName ( player ) ) end return tostring ( string.gsub ( string, "$data", data or "" ) ) end local node = aLogMessages[type][action] if ( node ) then local r, g, b = node["r"], node["g"], node["b"] if ( node["all"] ) then exports["guimessages"]:outputServer (_root, aStripString ( node["all"] ), r, g, b ) end if ( node["admin"] ) and ( admin ~= player ) then exports["guimessages"]:outputServer ( admin,aStripString ( node["admin"] ), r, g, b ) end if ( node["player"] ) then exports["guimessages"]:outputServer ( player,aStripString ( node["player"] ), r, g, b ) end if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end end end end وين الغلط تكفون ردو بسرعة /debugscript 3 واكتب الخطا الي يطلع لك مادري لو فيه احد فاضي يروح يشغل اللوكال هوست ويسوي سكربت ويحط الاكواد ويجربها عشان يطلع لك الخطا بس Link to comment
Recommended Posts