#DRAGON!FIRE Posted June 11, 2013 Share Posted June 11, 2013 ششوف أخوي # تروح للاسل وتروح القروبات : Moderator ---- قروب موديتورت x[ المشرف] SuperModerator قروب سوبر موديتورت Admin ----- قـروب ادمن # طيب الحين تروح للحقوق حقها # انسخ ذا السطر وحطه في كل قروب تبغاه #~ > # false انت خليها true ملاحظة : هي موجود بس ممكن ماتكون موجود بس لو كانت موجود ايام بتكون # ولو عندك استفسار او في شي منت فاهمه تفضل <~ Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 ششوف أخوي # تروح للاسل وتروح القروبات : Moderator ---- قروب موديتورت x[ المشرف] SuperModerator قروب سوبر موديتورت Admin ----- قـروب ادمن # طيب الحين تروح للحقوق حقها # انسخ ذا السطر وحطه في كل قروب تبغاه #~ > # false انت خليها true ملاحظة : هي موجود بس ممكن ماتكون موجود بس لو كانت موجود ايام بتكون # ولو عندك استفسار او في شي منت فاهمه تفضل <~ انا سويت كل الي قلته من زمان() + شف فوق انا طارح الاسل كامل Link to comment
#DRAGON!FIRE Posted June 11, 2013 Share Posted June 11, 2013 # مأ ادري صراحة يمكن المششكلة من عندك Link to comment
iPrestege Posted June 11, 2013 Share Posted June 11, 2013 -- Server Side # Vehicles = {} addEvent ( "givecar", true ) addEventHandler ( "givecar", root, function ( id ) if Vehicles [ source ] then destroyElement ( Vehicles [ source ] ) end if tonumber( id ) then local x, y, z = getElementPosition ( source ) Vehicles [ source ] = createVehicle ( tonumber( id ), x, y, z ) if Vehicles [ source ] then setVehicleDamageProof(Vehicles [ source ],true) setVehicleColor(Vehicles [ source ], 255, 255, 255) warpPedIntoVehicle ( source, Vehicles [ source ] ) setElementDimension( Vehicles [ source ],getElementDimension ( source ) or 1 ) end end end ) كذآ بيجيب العالم حق الاعب اللي صار لة ترايقر ويسوي السيارة فيه .. مشكور الكود الاول اشتغل حياكـ الله .. ذذ Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 # مأ ادري صراحة يمكن المششكلة من عندك اتوقع الحركه هذي بمود ولا شي Link to comment
#DRAGON!FIRE Posted June 11, 2013 Share Posted June 11, 2013 لأ لأ يا أخوي من الادمنية # <~ أنت شوف تـأكد كل شي # يعني الفنكشنات والكوماند حق فك الميوت ملغية في الاسل Link to comment
K1NG Posted June 11, 2013 Share Posted June 11, 2013 مافيه احد يعرف ؟ admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 مافيه احد يعرف ؟ admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" طيب بحاول وبرد لك خبر Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 #|=x=|K!NG|=x=|# wrote:admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" يصير كذا؟ function Delete ( ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return end end addEventHandler("onClientGUIClick",aMessagesForm, Delete) Link to comment
#DRAGON!FIRE Posted June 11, 2013 Share Posted June 11, 2013 #|=x=|K!NG|=x=|# wrote:admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" يصير كذا؟ function Delete ( ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return end end addEventHandler("onClientGUIClick",aMessagesForm, Delete) أخوي كود غلط # isObjectInACLGroup --- هذا سيرفر كيف تحطه في كلينت # سوي وقت يجي يضغط تريقر Link to comment
K1NG Posted June 11, 2013 Share Posted June 11, 2013 #|=x=|K!NG|=x=|# wrote:admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" يصير كذا؟ function Delete ( ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return end end addEventHandler("onClientGUIClick",aMessagesForm, Delete) لا ، سو تريقر لأنه وظيفة تحقق من قروب اللاعب تكون جانب سيرفر بس + لازم تحط الشرط على زر الحذف مهو الزر ذا + لازم تحطه بوظيفة الزر الأصلية مهو تسوي وظيفة جديدة ؛ على كل حال انت حاول فيه .. انا الحين بروح أنام .. لما أصحى لو ماعرفت تسويه أضبطه لكـ . Link to comment
AHMAD1234 Posted June 11, 2013 Share Posted June 11, 2013 منستر طيب انا الحين راح اسألك سؤال انت اذا جاك مشرف اوكي وعطاك ميوت كيف راح تفك الميوت حقك اذا كنت منت قادر على فكه الا اللي عطاك اياه..؟ Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 منستر طيب انا الحين راح اسألك سؤالانت اذا جاك مشرف اوكي وعطاك ميوت كيف راح تفك الميوت حقك اذا كنت منت قادر على فكه الا اللي عطاك اياه..؟ اقرا محتوى الموضوع Link to comment
#DRAGON!FIRE Posted June 11, 2013 Share Posted June 11, 2013 منستر طيب انا الحين راح اسألك سؤالانت اذا جاك مشرف اوكي وعطاك ميوت كيف راح تفك الميوت حقك اذا كنت منت قادر على فكه الا اللي عطاك اياه..؟ سسهل # يسوي وقت احد يصكه يتحقق من السيريال يلغي الامر <~ Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 #|=x=|K!NG|=x=|# wrote:admin-messages أخوي عدل على سكربت الأدمنية أظن بملف onClientGUIClick زي كذا أظن .. وعدل على زر حذف الرسايل بحدث سو شرط إذا كان اللاعب مهو بقروب كونسل ثم يسوي ريتيرن ذذ طبعاً لازم تسوي تريقر لأنه وظيفة تحقق من قروب اللاعب تكون بجانب سيرفر ذذ + دور على مكان زر فكـ الميوت وسوي عليه نفس الشي المشكلة مشوار اروح اسويها وارفعها -_-" يصير كذا؟ function Delete ( ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return end end addEventHandler("onClientGUIClick",aMessagesForm, Delete) لا ، سو تريقر لأنه وظيفة تحقق من قروب اللاعب تكون جانب سيرفر بس + لازم تحط الشرط على زر الحذف مهو الزر ذا + لازم تحطه بوظيفة الزر الأصلية مهو تسوي وظيفة جديدة ؛ على كل حال انت حاول فيه .. انا الحين بروح أنام .. لما أصحى لو ماعرفت تسويه أضبطه لكـ . اوك نوم العوافي Link to comment
AHMAD1234 Posted June 11, 2013 Share Posted June 11, 2013 منستر طيب انا الحين راح اسألك سؤالانت اذا جاك مشرف اوكي وعطاك ميوت كيف راح تفك الميوت حقك اذا كنت منت قادر على فكه الا اللي عطاك اياه..؟ اقرا محتوى الموضوع اوكي منستر بس نصيحة لا تعدل في ملفات الادمنية احتمال كبير تخرب الا اذا كنت داري عنها وبالتوفيق.. Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 (edited) كذا؟ function aClientMessagesClick ( button ) if ( button == "left" ) then if ( source == aMessagesClose ) then aViewMessagesClose ( false ) elseif ( source == aMessagesRefresh ) then triggerServerEvent ( "aMessage", getLocalPlayer(), "get" ) elseif ( source == aMessagesRead ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!", nil ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) aViewMessage ( tonumber ( id ) ) end elseif ( source == aMessagesDelete ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!" ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return triggerServerEvent ( "aMessage", getLocalPlayer(), "delete", tonumber ( id ) ) end end end end end Edited June 11, 2013 by Guest Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 منستر طيب انا الحين راح اسألك سؤالانت اذا جاك مشرف اوكي وعطاك ميوت كيف راح تفك الميوت حقك اذا كنت منت قادر على فكه الا اللي عطاك اياه..؟ اقرا محتوى الموضوع اوكي منستر بس نصيحة لا تعدل في ملفات الادمنية احتمال كبير تخرب الا اذا كنت داري عنها وبالتوفيق.. وياك + مشكور على النصيحه Link to comment
Bandito Posted June 11, 2013 Share Posted June 11, 2013 كذا؟ function aClientMessagesClick ( button ) if ( button == "left" ) then if ( source == aMessagesClose ) then aViewMessagesClose ( false ) elseif ( source == aMessagesRefresh ) then triggerServerEvent ( "aMessage", getLocalPlayer(), "get" ) elseif ( source == aMessagesRead ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!", nil ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) aViewMessage ( tonumber ( id ) ) end elseif ( source == aMessagesDelete ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!" ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return triggerServerEvent ( "aMessage", getLocalPlayer(), "delete", tonumber ( id ) ) end end end end end أخوي أنت حـاط ( Server Functions ) بـ ( Client Functions ) مآيصير .. Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 كذا؟ function aClientMessagesClick ( button ) if ( button == "left" ) then if ( source == aMessagesClose ) then aViewMessagesClose ( false ) elseif ( source == aMessagesRefresh ) then triggerServerEvent ( "aMessage", getLocalPlayer(), "get" ) elseif ( source == aMessagesRead ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!", nil ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) aViewMessage ( tonumber ( id ) ) end elseif ( source == aMessagesDelete ) then local row = guiGridListGetSelectedItem ( aMessagesList ) if ( row == -1 ) then aMessageBox ( "Warning", "No message selected!" ) else local id = guiGridListGetItemText ( aMessagesList, row, 1 ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then return triggerServerEvent ( "aMessage", getLocalPlayer(), "delete", tonumber ( id ) ) end end end end end أخوي أنت حـاط ( Server Functions ) بـ ( Client Functions ) مآيصير .. طيب + وش الحل Link to comment
jafar Posted June 11, 2013 Share Posted June 11, 2013 رح الى [admin]\admin\server\admin_server\ سطر 1325 الى سطر 1333 استبدله بذا elseif ( action == "delete" ) then if ( aReports[data] ) then local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup("user."..accName, aclGetGroup("Moderator2")) or isObjectInACLGroup("user."..accName, aclGetGroup("Moderator1")) then table.remove ( aReports, data ) end end triggerClientEvent ( source, "aMessage", source, "get", aReports ) else action = nil end end Link to comment
Stranger Posted June 11, 2013 Author Share Posted June 11, 2013 كذا ؟ --[[********************************** * * Multi Theft Auto - Admin Panel * * admin_server.lua * * Original File by lil_Toady * **************************************]] ----------------------- Protection -> EnadGroup = "Admin" EnadBanReason = "سبب الباند" EnadTable = { ["user.xxx"] = true, ["user.xxx"] = true, } ------------------------------------- _root = getRootElement() _types = { "player", "team", "vehicle", "resource", "bans", "server", "admin" } _settings = nil aPlayers = {} aLogMessages = {} aInteriors = {} aStats = {} aReports = {} aWeathers = {} aNickChangeTime = {} function notifyPlayerLoggedIn(player) outputChatBox ( "Press 'p' to open your admin panel", player ) local unread = 0 for _, msg in ipairs ( aReports ) do unread = unread + ( msg.read and 0 or 1 ) end if unread > 0 then outputChatBox( unread .. " unread Admin message" .. ( unread==1 and "" or "s" ), player, 255, 0, 0 ) end end addEventHandler ( "onResourceStart", _root, function ( resource ) if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStart", _root, getResourceName ( resource ) ) end end return end _settings = xmlLoadFile ( "conf\\settings.xml" ) if ( not _settings ) then _settings = xmlCreateFile ( "conf\\settings.xml", "main" ) xmlSaveFile ( _settings ) end aSetupACL() aSetupCommands() for id, player in ipairs ( getElementsByType ( "player" ) ) do aPlayerInitialize ( player ) if ( hasObjectPermissionTo ( player, "general.adminpanel" ) ) then notifyPlayerLoggedIn(player) end end local node = xmlLoadFile ( "conf\\interiors.xml" ) if ( node ) then local interiors = 0 while ( xmlFindChild ( node, "interior", interiors ) ) do local interior = xmlFindChild ( node, "interior", interiors ) interiors = interiors + 1 aInteriors[interiors] = {} aInteriors[interiors]["world"] = tonumber ( xmlNodeGetAttribute ( interior, "world" ) ) aInteriors[interiors]["id"] = xmlNodeGetAttribute ( interior, "id" ) aInteriors[interiors]["x"] = xmlNodeGetAttribute ( interior, "posX" ) aInteriors[interiors]["y"] = xmlNodeGetAttribute ( interior, "posY" ) aInteriors[interiors]["z"] = xmlNodeGetAttribute ( interior, "posZ" ) aInteriors[interiors]["r"] = xmlNodeGetAttribute ( interior, "rot" ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\stats.xml" ) if ( node ) then local stats = 0 while ( xmlFindChild ( node, "stat", stats ) ) do local stat = xmlFindChild ( node, "stat", stats ) local id = tonumber ( xmlNodeGetAttribute ( stat, "id" ) ) local name = xmlNodeGetAttribute ( stat, "name" ) aStats[id] = name stats = stats + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\weathers.xml" ) if ( node ) then local weathers = 0 while ( xmlFindChild ( node, "weather", weathers ) ~= false ) do local weather = xmlFindChild ( node, "weather", weathers ) local id = tonumber ( xmlNodeGetAttribute ( weather, "id" ) ) local name = xmlNodeGetAttribute ( weather, "name" ) aWeathers[id] = name weathers = weathers + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then local messages = 0 while ( xmlFindChild ( node, "message", messages ) ) do subnode = xmlFindChild ( node, "message", messages ) local author = xmlFindChild ( subnode, "author", 0 ) local subject = xmlFindChild ( subnode, "subject", 0 ) local category = xmlFindChild ( subnode, "category", 0 ) local text = xmlFindChild ( subnode, "text", 0 ) local time = xmlFindChild ( subnode, "time", 0 ) local read = ( xmlFindChild ( subnode, "read", 0 ) ~= false ) local id = #aReports + 1 aReports[id] = {} if ( author ) then aReports[id].author = xmlNodeGetValue ( author ) else aReports[id].author = "" end if ( category ) then aReports[id].category = xmlNodeGetValue ( category ) else aReports[id].category = "" end if ( subject ) then aReports[id].subject = xmlNodeGetValue ( subject ) else aReports[id].subject = "" end if ( text ) then aReports[id].text = xmlNodeGetValue ( text ) else aReports[id].text = "" end if ( time ) then aReports[id].time = xmlNodeGetValue ( time ) else aReports[id].time = "" end aReports[id].read = read messages = messages + 1 end -- Remove duplicates local a = 1 while a <= #aReports do local b = a + 1 while b <= #aReports do if table.cmp( aReports[a], aReports[b] ) then table.remove( aReports, b ) b = b - 1 end b = b + 1 end a = a + 1 end -- Upgrade time from '4/9 5:9' to '2009-09-04 05:09' for id, rep in ipairs ( aReports ) do if string.find( rep.time, "/" ) then local monthday, month, hour, minute = string.match( rep.time, "^(.-)/(.-) (.-).-)$" ) rep.time = string.format( '%04d-%02d-%02d %02d:%02d', 2009, month + 1, monthday, hour, minute ) end end -- Sort messages by time table.sort(aReports, function(a,b) return(a.time < b.time) end) -- Limit number of messages while #aReports > g_Prefs.maxmsgs do table.remove( aReports, 1 ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\messages.xml" ) if ( node ) then for id, type in ipairs ( _types ) do local subnode = xmlFindChild ( node, type, 0 ) if ( subnode ) then aLogMessages[type] = {} local groups = 0 while ( xmlFindChild ( subnode, "group", groups ) ) do local group = xmlFindChild ( subnode, "group", groups ) local action = xmlNodeGetAttribute ( group, "action" ) local r = tonumber ( xmlNodeGetAttribute ( group, "r" ) ) local g = tonumber ( xmlNodeGetAttribute ( group, "g" ) ) local b = tonumber ( xmlNodeGetAttribute ( group, "b" ) ) aLogMessages[type][action] = {} aLogMessages[type][action]["r"] = r or 0 aLogMessages[type][action]["g"] = g or 255 aLogMessages[type][action]["b"] = b or 0 if ( xmlFindChild ( group, "all", 0 ) ) then aLogMessages[type][action]["all"] = xmlNodeGetValue ( xmlFindChild ( group, "all", 0 ) ) end if ( xmlFindChild ( group, "admin", 0 ) ) then aLogMessages[type][action]["admin"] = xmlNodeGetValue ( xmlFindChild ( group, "admin", 0 ) ) end if ( xmlFindChild ( group, "player", 0 ) ) then aLogMessages[type][action]["player"] = xmlNodeGetValue ( xmlFindChild ( group, "player", 0 ) ) end if ( xmlFindChild ( group, "log", 0 ) ) then aLogMessages[type][action]["log"] = xmlNodeGetValue ( xmlFindChild ( group, "log", 0 ) ) end groups = groups + 1 end end end xmlUnloadFile ( node ) end end ) addEventHandler ( "onResourceStop", _root, function ( resource ) -- Incase the resource being stopped has been deleted local stillExists = false for i, res in ipairs(getResources()) do if res == resource then stillExists = true break end end if not stillExists then return end if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStop", _root, getResourceName ( resource ) ) end end else local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then while ( xmlFindChild ( node, "message", 0 ) ~= false ) do local subnode = xmlFindChild ( node, "message", 0 ) xmlDestroyNode ( subnode ) end else node = xmlCreateFile ( "conf\\reports.xml", "messages" ) end for id, message in ipairs ( aReports ) do local subnode = xmlCreateChild ( node, "message" ) for key, value in pairs ( message ) do if ( value ) then xmlNodeSetValue ( xmlCreateChild ( subnode, key ), tostring ( value ) ) end end end xmlSaveFile ( node ) xmlUnloadFile ( node ) end aclSave () end ) function aGetSetting ( setting ) local result = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( result ) then result = xmlNodeGetValue ( result ) if ( result == "true" ) then return true elseif ( result == "false" ) then return false else return result end end return false end function aSetSetting ( setting, value ) local node = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( not node ) then node = xmlCreateChild ( _settings, tostring ( setting ) ) end xmlNodeSetValue ( node, tostring ( value ) ) xmlSaveFile ( _settings ) end function aRemoveSetting ( setting ) local node = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( node ) then Link to comment
jafar Posted June 11, 2013 Share Posted June 11, 2013 ماكنت ادري انك معدل على الملف فمن كذا اختلفت الأسطر على العموم يصير كذا .. --[[********************************** * * Multi Theft Auto - Admin Panel * * admin_server.lua * * Original File by lil_Toady * **************************************]] ----------------------- Protection -> EnadGroup = "Admin" EnadBanReason = "سبب الباند" EnadTable = { ["user.xxx"] = true, ["user.xxx"] = true, } ------------------------------------- _root = getRootElement() _types = { "player", "team", "vehicle", "resource", "bans", "server", "admin" } _settings = nil aPlayers = {} aLogMessages = {} aInteriors = {} aStats = {} aReports = {} aWeathers = {} aNickChangeTime = {} function notifyPlayerLoggedIn(player) outputChatBox ( "Press 'p' to open your admin panel", player ) local unread = 0 for _, msg in ipairs ( aReports ) do unread = unread + ( msg.read and 0 or 1 ) end if unread > 0 then outputChatBox( unread .. " unread Admin message" .. ( unread==1 and "" or "s" ), player, 255, 0, 0 ) end end addEventHandler ( "onResourceStart", _root, function ( resource ) if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStart", _root, getResourceName ( resource ) ) end end return end _settings = xmlLoadFile ( "conf\\settings.xml" ) if ( not _settings ) then _settings = xmlCreateFile ( "conf\\settings.xml", "main" ) xmlSaveFile ( _settings ) end aSetupACL() aSetupCommands() for id, player in ipairs ( getElementsByType ( "player" ) ) do aPlayerInitialize ( player ) if ( hasObjectPermissionTo ( player, "general.adminpanel" ) ) then notifyPlayerLoggedIn(player) end end local node = xmlLoadFile ( "conf\\interiors.xml" ) if ( node ) then local interiors = 0 while ( xmlFindChild ( node, "interior", interiors ) ) do local interior = xmlFindChild ( node, "interior", interiors ) interiors = interiors + 1 aInteriors[interiors] = {} aInteriors[interiors]["world"] = tonumber ( xmlNodeGetAttribute ( interior, "world" ) ) aInteriors[interiors]["id"] = xmlNodeGetAttribute ( interior, "id" ) aInteriors[interiors]["x"] = xmlNodeGetAttribute ( interior, "posX" ) aInteriors[interiors]["y"] = xmlNodeGetAttribute ( interior, "posY" ) aInteriors[interiors]["z"] = xmlNodeGetAttribute ( interior, "posZ" ) aInteriors[interiors]["r"] = xmlNodeGetAttribute ( interior, "rot" ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\stats.xml" ) if ( node ) then local stats = 0 while ( xmlFindChild ( node, "stat", stats ) ) do local stat = xmlFindChild ( node, "stat", stats ) local id = tonumber ( xmlNodeGetAttribute ( stat, "id" ) ) local name = xmlNodeGetAttribute ( stat, "name" ) aStats[id] = name stats = stats + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\weathers.xml" ) if ( node ) then local weathers = 0 while ( xmlFindChild ( node, "weather", weathers ) ~= false ) do local weather = xmlFindChild ( node, "weather", weathers ) local id = tonumber ( xmlNodeGetAttribute ( weather, "id" ) ) local name = xmlNodeGetAttribute ( weather, "name" ) aWeathers[id] = name weathers = weathers + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then local messages = 0 while ( xmlFindChild ( node, "message", messages ) ) do subnode = xmlFindChild ( node, "message", messages ) local author = xmlFindChild ( subnode, "author", 0 ) local subject = xmlFindChild ( subnode, "subject", 0 ) local category = xmlFindChild ( subnode, "category", 0 ) local text = xmlFindChild ( subnode, "text", 0 ) local time = xmlFindChild ( subnode, "time", 0 ) local read = ( xmlFindChild ( subnode, "read", 0 ) ~= false ) local id = #aReports + 1 aReports[id] = {} if ( author ) then aReports[id].author = xmlNodeGetValue ( author ) else aReports[id].author = "" end if ( category ) then aReports[id].category = xmlNodeGetValue ( category ) else aReports[id].category = "" end if ( subject ) then aReports[id].subject = xmlNodeGetValue ( subject ) else aReports[id].subject = "" end if ( text ) then aReports[id].text = xmlNodeGetValue ( text ) else aReports[id].text = "" end if ( time ) then aReports[id].time = xmlNodeGetValue ( time ) else aReports[id].time = "" end aReports[id].read = read messages = messages + 1 end -- Remove duplicates local a = 1 while a <= #aReports do local b = a + 1 while b <= #aReports do if table.cmp( aReports[a], aReports[b] ) then table.remove( aReports, b ) b = b - 1 end b = b + 1 end a = a + 1 end -- Upgrade time from '4/9 5:9' to '2009-09-04 05:09' for id, rep in ipairs ( aReports ) do if string.find( rep.time, "/" ) then local monthday, month, hour, minute = string.match( rep.time, "^(.-)/(.-) (.-).-)$" ) rep.time = string.format( '%04d-%02d-%02d %02d:%02d', 2009, month + 1, monthday, hour, minute ) end end -- Sort messages by time table.sort(aReports, function(a,b) return(a.time < b.time) end) -- Limit number of messages while #aReports > g_Prefs.maxmsgs do table.remove( aReports, 1 ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\messages.xml" ) if ( node ) then for id, type in ipairs ( _types ) do local subnode = xmlFindChild ( node, type, 0 ) if ( subnode ) then aLogMessages[type] = {} local groups = 0 while ( xmlFindChild ( subnode, "group", groups ) ) do local group = xmlFindChild ( subnode, "group", groups ) local action = xmlNodeGetAttribute ( group, "action" ) local r = tonumber ( xmlNodeGetAttribute ( group, "r" ) ) local g = tonumber ( xmlNodeGetAttribute ( group, "g" ) ) local b = tonumber ( xmlNodeGetAttribute ( group, "b" ) ) aLogMessages[type][action] = {} aLogMessages[type][action]["r"] = r or 0 aLogMessages[type][action]["g"] = g or 255 aLogMessages[type][action]["b"] = b or 0 if ( xmlFindChild ( group, "all", 0 ) ) then aLogMessages[type][action]["all"] = xmlNodeGetValue ( xmlFindChild ( group, "all", 0 ) ) end if ( xmlFindChild ( group, "admin", 0 ) ) then aLogMessages[type][action]["admin"] = xmlNodeGetValue ( xmlFindChild ( group, "admin", 0 ) ) end if ( xmlFindChild ( group, "player", 0 ) ) then aLogMessages[type][action]["player"] = xmlNodeGetValue ( xmlFindChild ( group, "player", 0 ) ) end if ( xmlFindChild ( group, "log", 0 ) ) then aLogMessages[type][action]["log"] = xmlNodeGetValue ( xmlFindChild ( group, "log", 0 ) ) end groups = groups + 1 end end end xmlUnloadFile ( node ) end end ) addEventHandler ( "onResourceStop", _root, function ( resource ) -- Incase the resource being stopped has been deleted local stillExists = false for i, res in ipairs(getResources()) do if res == resource then stillExists = true break end end if not stillExists then return end if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStop", _root, getResourceName ( resource ) ) end end else local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then while ( xmlFindChild ( node, "message", 0 ) ~= false ) do local subnode = xmlFindChild ( node, "message", 0 ) xmlDestroyNode ( subnode ) end else node = xmlCreateFile ( "conf\\reports.xml", "messages" ) end for id, message in ipairs ( aReports ) do local subnode = xmlCreateChild ( node, "message" ) for key, value in pairs ( message ) do if ( value ) then xmlNodeSetValue ( xmlCreateChild ( subnode, key ), tostring ( value ) ) end end end xmlSaveFile ( node ) xmlUnloadFile ( node ) end aclSave () end ) function aGetSetting ( setting ) local result = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( result ) then result = xmlNodeGetValue ( result ) if ( result == "true" ) then return true elseif ( result == "false" ) then return false else return result end end return false end function aSetSetting ( setting, value ) local node = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( not node ) then node = xmlCreateChild ( _settings, tostring ( setting ) ) end xmlNodeSetValue ( node, tostring ( value ) ) xmlSaveFile ( _settings ) end function aRemoveSetting ( setting ) local node = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( node ) then Link to comment
Stranger Posted June 12, 2013 Author Share Posted June 12, 2013 ماكنت ادري انك معدل على الملف فمن كذا اختلفت الأسطر على العموم يصير كذا .. --[[********************************** * * Multi Theft Auto - Admin Panel * * admin_server.lua * * Original File by lil_Toady * **************************************]] ----------------------- Protection -> EnadGroup = "Admin" EnadBanReason = "سبب الباند" EnadTable = { ["user.xxx"] = true, ["user.xxx"] = true, } ------------------------------------- _root = getRootElement() _types = { "player", "team", "vehicle", "resource", "bans", "server", "admin" } _settings = nil aPlayers = {} aLogMessages = {} aInteriors = {} aStats = {} aReports = {} aWeathers = {} aNickChangeTime = {} function notifyPlayerLoggedIn(player) outputChatBox ( "Press 'p' to open your admin panel", player ) local unread = 0 for _, msg in ipairs ( aReports ) do unread = unread + ( msg.read and 0 or 1 ) end if unread > 0 then outputChatBox( unread .. " unread Admin message" .. ( unread==1 and "" or "s" ), player, 255, 0, 0 ) end end addEventHandler ( "onResourceStart", _root, function ( resource ) if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStart", _root, getResourceName ( resource ) ) end end return end _settings = xmlLoadFile ( "conf\\settings.xml" ) if ( not _settings ) then _settings = xmlCreateFile ( "conf\\settings.xml", "main" ) xmlSaveFile ( _settings ) end aSetupACL() aSetupCommands() for id, player in ipairs ( getElementsByType ( "player" ) ) do aPlayerInitialize ( player ) if ( hasObjectPermissionTo ( player, "general.adminpanel" ) ) then notifyPlayerLoggedIn(player) end end local node = xmlLoadFile ( "conf\\interiors.xml" ) if ( node ) then local interiors = 0 while ( xmlFindChild ( node, "interior", interiors ) ) do local interior = xmlFindChild ( node, "interior", interiors ) interiors = interiors + 1 aInteriors[interiors] = {} aInteriors[interiors]["world"] = tonumber ( xmlNodeGetAttribute ( interior, "world" ) ) aInteriors[interiors]["id"] = xmlNodeGetAttribute ( interior, "id" ) aInteriors[interiors]["x"] = xmlNodeGetAttribute ( interior, "posX" ) aInteriors[interiors]["y"] = xmlNodeGetAttribute ( interior, "posY" ) aInteriors[interiors]["z"] = xmlNodeGetAttribute ( interior, "posZ" ) aInteriors[interiors]["r"] = xmlNodeGetAttribute ( interior, "rot" ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\stats.xml" ) if ( node ) then local stats = 0 while ( xmlFindChild ( node, "stat", stats ) ) do local stat = xmlFindChild ( node, "stat", stats ) local id = tonumber ( xmlNodeGetAttribute ( stat, "id" ) ) local name = xmlNodeGetAttribute ( stat, "name" ) aStats[id] = name stats = stats + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\weathers.xml" ) if ( node ) then local weathers = 0 while ( xmlFindChild ( node, "weather", weathers ) ~= false ) do local weather = xmlFindChild ( node, "weather", weathers ) local id = tonumber ( xmlNodeGetAttribute ( weather, "id" ) ) local name = xmlNodeGetAttribute ( weather, "name" ) aWeathers[id] = name weathers = weathers + 1 end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then local messages = 0 while ( xmlFindChild ( node, "message", messages ) ) do subnode = xmlFindChild ( node, "message", messages ) local author = xmlFindChild ( subnode, "author", 0 ) local subject = xmlFindChild ( subnode, "subject", 0 ) local category = xmlFindChild ( subnode, "category", 0 ) local text = xmlFindChild ( subnode, "text", 0 ) local time = xmlFindChild ( subnode, "time", 0 ) local read = ( xmlFindChild ( subnode, "read", 0 ) ~= false ) local id = #aReports + 1 aReports[id] = {} if ( author ) then aReports[id].author = xmlNodeGetValue ( author ) else aReports[id].author = "" end if ( category ) then aReports[id].category = xmlNodeGetValue ( category ) else aReports[id].category = "" end if ( subject ) then aReports[id].subject = xmlNodeGetValue ( subject ) else aReports[id].subject = "" end if ( text ) then aReports[id].text = xmlNodeGetValue ( text ) else aReports[id].text = "" end if ( time ) then aReports[id].time = xmlNodeGetValue ( time ) else aReports[id].time = "" end aReports[id].read = read messages = messages + 1 end -- Remove duplicates local a = 1 while a <= #aReports do local b = a + 1 while b <= #aReports do if table.cmp( aReports[a], aReports[b] ) then table.remove( aReports, b ) b = b - 1 end b = b + 1 end a = a + 1 end -- Upgrade time from '4/9 5:9' to '2009-09-04 05:09' for id, rep in ipairs ( aReports ) do if string.find( rep.time, "/" ) then local monthday, month, hour, minute = string.match( rep.time, "^(.-)/(.-) (.-).-)$" ) rep.time = string.format( '%04d-%02d-%02d %02d:%02d', 2009, month + 1, monthday, hour, minute ) end end -- Sort messages by time table.sort(aReports, function(a,b) return(a.time < b.time) end) -- Limit number of messages while #aReports > g_Prefs.maxmsgs do table.remove( aReports, 1 ) end xmlUnloadFile ( node ) end local node = xmlLoadFile ( "conf\\messages.xml" ) if ( node ) then for id, type in ipairs ( _types ) do local subnode = xmlFindChild ( node, type, 0 ) if ( subnode ) then aLogMessages[type] = {} local groups = 0 while ( xmlFindChild ( subnode, "group", groups ) ) do local group = xmlFindChild ( subnode, "group", groups ) local action = xmlNodeGetAttribute ( group, "action" ) local r = tonumber ( xmlNodeGetAttribute ( group, "r" ) ) local g = tonumber ( xmlNodeGetAttribute ( group, "g" ) ) local b = tonumber ( xmlNodeGetAttribute ( group, "b" ) ) aLogMessages[type][action] = {} aLogMessages[type][action]["r"] = r or 0 aLogMessages[type][action]["g"] = g or 255 aLogMessages[type][action]["b"] = b or 0 if ( xmlFindChild ( group, "all", 0 ) ) then aLogMessages[type][action]["all"] = xmlNodeGetValue ( xmlFindChild ( group, "all", 0 ) ) end if ( xmlFindChild ( group, "admin", 0 ) ) then aLogMessages[type][action]["admin"] = xmlNodeGetValue ( xmlFindChild ( group, "admin", 0 ) ) end if ( xmlFindChild ( group, "player", 0 ) ) then aLogMessages[type][action]["player"] = xmlNodeGetValue ( xmlFindChild ( group, "player", 0 ) ) end if ( xmlFindChild ( group, "log", 0 ) ) then aLogMessages[type][action]["log"] = xmlNodeGetValue ( xmlFindChild ( group, "log", 0 ) ) end groups = groups + 1 end end end xmlUnloadFile ( node ) end end ) addEventHandler ( "onResourceStop", _root, function ( resource ) -- Incase the resource being stopped has been deleted local stillExists = false for i, res in ipairs(getResources()) do if res == resource then stillExists = true break end end if not stillExists then return end if ( resource ~= getThisResource() ) then for id, player in ipairs(getElementsByType("player")) do if ( hasObjectPermissionTo ( player, "general.tab_resources" ) ) then triggerClientEvent ( player, "aClientResourceStop", _root, getResourceName ( resource ) ) end end else local node = xmlLoadFile ( "conf\\reports.xml" ) if ( node ) then while ( xmlFindChild ( node, "message", 0 ) ~= false ) do local subnode = xmlFindChild ( node, "message", 0 ) xmlDestroyNode ( subnode ) end else node = xmlCreateFile ( "conf\\reports.xml", "messages" ) end for id, message in ipairs ( aReports ) do local subnode = xmlCreateChild ( node, "message" ) for key, value in pairs ( message ) do if ( value ) then xmlNodeSetValue ( xmlCreateChild ( subnode, key ), tostring ( value ) ) end end end xmlSaveFile ( node ) xmlUnloadFile ( node ) end aclSave () end ) function aGetSetting ( setting ) local result = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( result ) then result = xmlNodeGetValue ( result ) if ( result == "true" ) then return true elseif ( result == "false" ) then return false else return result end end return false end function aSetSetting ( setting, value ) local node = xmlFindChild ( _settings, tostring ( setting ), 0 ) if ( not node ) then node = xmlCreateChild ( _settings, tostring ( setting ) ) end xmlNodeSetValue ( node, tostring ( value ) ) xmlSaveFile ( _settings ) end function aRemoveSetting ( setting ) 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