Jump to content

طلب مبرمج يضفلي كود


Recommended Posts

سلام عليكم 

آبي طلب سهل بآلنسبة للمبرمجين

في آخ منزل بآلمسآهمآت مود آلمخآلفآت - هو شغآل ولمآ آضغط علي زر يرقي آلشخص آدمن آكس

لكن في مشكلة صآحب آلمود نسي يسويهآ - آنه يسحب جميع آلرتب آلي مع آلشخص آلي حددته بآلآيديت بوكس 

فآ ممكن بس لو آحد يقدر يسويلي آن لمآ يضيف له آدمن آكس - يسويلي آنه يسحب كل رتتبه

وشكرآ لكم

GUIEditor = {
    label = {},
    edit = {},
    button = {},
    window = {},
    gridlist = {},
    memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(206, 105, 357, 341, "", false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetAlpha(GUIEditor.window[1], 1.00)
		guiSetVisible ( GUIEditor.window[1],false )
        GUIEditor.label[1] = guiCreateLabel(5, 24, 348, 18, "مرحبآ بك في نظآم صك المخالفات", false, GUIEditor.window[1])
        local font0_seguisym = guiCreateFont(":Mn.ttf", 19)
        guiSetFont(GUIEditor.label[1], font0_seguisym)
        guiLabelSetColor(GUIEditor.label[1], 199, 35, 35)
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
        GUIEditor.memo[1] = guiCreateMemo(0.03, 0.15, 0.94, 0.14, "       لـصك مخالفه عليك تحديد حساب الاعب             \nو تحديد مدة المخالفه و سببها ثم ظغط زر اعطاء مخالفه     ", true, GUIEditor.window[1])
        GUIEditor.edit[1] = guiCreateEdit(227, 140, 55, 24, "", false, GUIEditor.window[1])
        GUIEditor.label[2] = guiCreateLabel(278, 140, 75, 22, "مدة المخالفه", false, GUIEditor.window[1])
        local font1_seguisym = guiCreateFont("Mn.ttf", 11)
        guiSetFont(GUIEditor.label[2], font1_seguisym)
        guiLabelSetColor(GUIEditor.label[2], 0, 250, 253)
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
        GUIEditor.gridlist[1] = guiCreateGridList(10, 135, 125, 196, false, GUIEditor.window[1])
        guiGridListAddColumn(GUIEditor.gridlist[1], "Account", 0.9)
        GUIEditor.label[3] = guiCreateLabel(276, 178, 81, 27, "سبب المخالفه", false, GUIEditor.window[1])
        local font2_seguisym = guiCreateFont("Mn.ttf", 10)
        guiSetFont(GUIEditor.label[3], font2_seguisym)
        guiLabelSetColor(GUIEditor.label[3], 0, 234, 231)
        guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
        GUIEditor.edit[2] = guiCreateEdit(153, 178, 129, 23, "", false, GUIEditor.window[1])
        GUIEditor.label[4] = guiCreateLabel(145, 140, 82, 25, "الحد الاقصى 4 ايام", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[4], font2_seguisym)
        guiLabelSetColor(GUIEditor.label[4], 222, 214, 1)
        guiLabelSetHorizontalAlign(GUIEditor.label[4], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[4], "center")
        GUIEditor.label[5] = guiCreateLabel(135, 104, 211, 26, " تنبيه : المخالفه بدون سبب = سحب رتبه ", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[5], font1_seguisym)
        guiLabelSetColor(GUIEditor.label[5], 255, 3, 3)
        guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[5], "center")
        GUIEditor.label[6] = guiCreateLabel(339, 114, 24, 21, "*", false, GUIEditor.window[1])
        guiLabelSetColor(GUIEditor.label[6], 246, 238, 17)
        editBox = guiCreateEdit(9, 111, 126, 19, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(155, 215, 145, 26, "آعطآء مخالفه", false, GUIEditor.window[1])
        local font3_seguisym = guiCreateFont("Mn.ttf", 14)
        guiSetFont(GUIEditor.button[1], font3_seguisym)
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FE1FDE00")
        GUIEditor.button[2] = guiCreateButton(155, 251, 145, 26, "لوحة التحكم", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], font3_seguisym)
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFC72323")
        GUIEditor.button[3] = guiCreateButton(155, 287, 145, 26, "إغلاق ", false, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[3], font3_seguisym)
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF00FAFD")


        GUIEditor.label[7] = guiCreateLabel(206, 147, 347, 25, "", false)


        GUIEditor.label[8] = guiCreateLabel(206, 147, 347, 25, "", false)    
    end
)

addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[2] = guiCreateWindow(370, 138, 381, 298, "", false)
        guiWindowSetSizable(GUIEditor.window[2], false)
        guiSetAlpha(GUIEditor.window[2], 1.00)
		guiSetVisible ( GUIEditor.window[2],false )
        GUIEditor.gridlist[2] = guiCreateGridList(15, 30, 345, 213, false, GUIEditor.window[2])
        guiGridListAddColumn(GUIEditor.gridlist[2], "Account", 0.3)
        guiGridListAddColumn(GUIEditor.gridlist[2], "Day", 0.3)
        guiGridListAddColumn(GUIEditor.gridlist[2], "Sbb", 0.3)
        GUIEditor.button[11] = guiCreateButton(19, 257, 114, 31, "حذف المخالفه", false, GUIEditor.window[2])
        local font0_seguisym = guiCreateFont("Mn.ttf", 13)
        guiSetFont(GUIEditor.button[11], font0_seguisym)
        guiSetProperty(GUIEditor.button[11], "NormalTextColour", "FE05B7D7")
        GUIEditor.button[21] = guiCreateButton(139, 257, 114, 31, "مسح جميع المخالفات", false, GUIEditor.window[2])
        local font1_seguisym = guiCreateFont("Mn.ttf", 12)
        guiSetFont(GUIEditor.button[21], font1_seguisym)
        guiSetProperty(GUIEditor.button[21], "NormalTextColour", "FFC42525")
        GUIEditor.button[31] = guiCreateButton(261, 257, 110, 31, "[ X ]", false, GUIEditor.window[2])
        local font2_seguisym = guiCreateFont("Mn.ttf", 24)
        guiSetFont(GUIEditor.button[31], font2_seguisym)
        guiSetProperty(GUIEditor.button[31], "NormalTextColour", "FFFFFC01")


        GUIEditor.label[1] = guiCreateLabel(206, 147, 347, 25, "", false)


        GUIEditor.label[2] = guiCreateLabel(206, 147, 347, 25, "", false)    
    end
)





addEvent("Acconts",true )
addEventHandler("Acconts",root, function (T)
   guiGridListClear(GUIEditor.gridlist[1])
       for i, aAccount in ipairs (T) do
           Row = guiGridListAddRow(GUIEditor.gridlist[1])
           guiGridListSetItemText(GUIEditor.gridlist[1], Row, 1, aAccount, false, false )
		   
    end
	Accounts = T
end 
)

addEventHandler("onClientGUIChanged",resourceRoot,function ()
	guiGridListClear(GUIEditor.gridlist[1])
   local Accs = guiGetText (editBox)
        if ( Accs == "" ) then
            for k,v in ipairs(Accounts) do
        Row = guiGridListAddRow(GUIEditor.gridlist[1])
         guiGridListSetItemText(GUIEditor.gridlist[1], Row, 1, v, false, false )
            end
        else
		guiGridListClear(GUIEditor.gridlist[1])
            for k1,v1 in ipairs(Accounts) do
                if string.find(v1,guiGetText(editBox)) then
                    local Row = guiGridListAddRow(GUIEditor.gridlist[1])
                    guiGridListSetItemText(GUIEditor.gridlist[1],Row,1,v1,false,false)
            end
        end
    end
end
)

Time = 1000 -- عدد الثواني لـ فتح الزر بعد الضغط عليه
  addEventHandler ( "onClientGUIClick",root, function (  )
  	 if source == GUIEditor.button[1] then
  if guiGridListGetSelectedItem(GUIEditor.gridlist[1]) == -1  then  outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff الرجاء تحديد الحساب من القائمه', 255, 255, 255, true)  return end 
    local player1 = guiGridListGetItemText(GUIEditor.gridlist[1], guiGridListGetSelectedItem(GUIEditor.gridlist[1]), 1) 
     local editdays = guiGetText ( GUIEditor.edit[1] )
       if editdays == "" then outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x :  #ffffff الرجاء كتابة عدد ايام المخالفه', 255, 255, 255, true)  return end 	
	  local editdays1 = tonumber ( guiGetText ( GUIEditor.edit[1] ) )
	  if  not tonumber(editdays1) then outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x :  #ffffff الرجاء كتابة ارقام فقط', 255, 255, 255, true)  return end 
	if ( editdays1 >= 5 ) then outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff لايمكن صك مخالفه اكثر من 4 ايام ', 255, 255, 255, true)  return end 
		 editsbab = guiGetText (GUIEditor.edit[2])
	            if editsbab == "" then outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff الرجاء كتابة سبب المخالفه', 255, 255, 255, true)  return end 
				guiSetEnabled ( GUIEditor.button[1],false );
      setTimer ( guiSetEnabled,Time,1,GUIEditor.button[1],true );  
                   triggerServerEvent("aAdminEx1",localPlayer,player1,editdays,editsbab)
				   
     end
  end
)

  addEventHandler ( "onClientGUIClick",root, function (  )
  	 if source == GUIEditor.button[3] then
		guiSetVisible ( GUIEditor.window[1],false )
        showCursor ( false )		
     elseif source == GUIEditor.button[2] then
	    guiSetVisible ( GUIEditor.window[2],true )
		guiSetVisible ( GUIEditor.window[1],false )
		guiGridListClear(GUIEditor.gridlist[2])
        triggerServerEvent( 'getDatas', localPlayer)		
     elseif source == GUIEditor.button[31] then
	    guiSetVisible ( GUIEditor.window[2],false )
        guiSetVisible ( GUIEditor.window[1],true )
     elseif source == GUIEditor.button[11] then
	   if guiGridListGetSelectedItem(GUIEditor.gridlist[2]) == -1  then  outputChatBox('#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff الرجاء تحديد الحساب من القائمه', 255, 255, 255, true)  return end 
        local players2 = guiGridListGetItemText(GUIEditor.gridlist[2], guiGridListGetSelectedItem(GUIEditor.gridlist[2]), 1)
		 outputChatBox ( players2 ) 
         triggerServerEvent( 'removeAdminEx', localPlayer,players2)
     elseif source == GUIEditor.button[21] then
         triggerServerEvent( 'removeaAdminSystem',localPlayer)			 
	  end
    end
 )


 addEvent ( "aGrid", true )
 addEventHandler ( "aGrid", root, function(account,editdays,editsbab)
 guiGridListClear(GUIEditor.gridlist[2])
   local row = guiGridListAddRow (GUIEditor.gridlist[2])
   guiGridListSetItemText (GUIEditor.gridlist[2],row,1,account,false,false)
   guiGridListSetItemText (GUIEditor.gridlist[2],row,2,editdays,false,false)
   guiGridListSetItemText (GUIEditor.gridlist[2],row,3,editsbab,false,false)		
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,1, 222, 200, 22 )
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,2, 220, 220, 250 )
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,3, 220, 220, 250 )
  end
)


 addEventHandler( 'onClientResourceStart', resourceRoot,
 function()
  guiGridListClear(GUIEditor.gridlist[2])
   triggerServerEvent( 'getDatas', localPlayer)
   triggerServerEvent( 'aAdminEx', localPlayer)
  end
)

 addEvent ( "data", true )
 addEventHandler ( "data", root, function()
  guiGridListClear(GUIEditor.gridlist[2])
  triggerServerEvent( 'getDatas', localPlayer)
 end
)

 addEvent ( "data1", true )
 addEventHandler ( "data1", root, function()
  guiGridListClear(GUIEditor.gridlist[2])
  guiSetVisible ( GUIEditor.window[1],true )
  guiSetVisible ( GUIEditor.window[2],false )
  showCursor ( true )
 end
)


 addEvent ( "datasCallBack", true )
 addEventHandler ( "datasCallBack", root, function(tabl)
 guiGridListClear(GUIEditor.gridlist[2])
   for k,v in ipairs(tabl) do
   local row = guiGridListAddRow (GUIEditor.gridlist[2])
   guiGridListSetItemText (GUIEditor.gridlist[2],row,1,v.account,false,false)
   guiGridListSetItemText (GUIEditor.gridlist[2],row,2,v.editdays,false,false)
   guiGridListSetItemText (GUIEditor.gridlist[2],row,3,v.editsbab,false,false)		
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,1, 222, 200, 22 )
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,2, 220, 220, 250 )
   guiGridListSetItemColor ( GUIEditor.gridlist[2],row,3, 220, 220, 250 )
   end
 end 
)


function OpEn ( )  
guiSetVisible ( GUIEditor.window[1],true )
showCursor ( true )
triggerServerEvent( 'aAdminEx', localPlayer)
end
addEvent ( "Open", true )
addEventHandler ( "Open", root, OpEn )

سيرفر


--- Server #
function MnHmAr1 (  )
    executeSQLQuery('CREATE TABLE IF NOT EXISTS aAdminSystem (account,editdays,editsbab)')
end
addEventHandler ( "onResourceStart", getRootElement(), MnHmAr1 )


addEvent ( 'aAdminEx',true ) 
addEventHandler( 'aAdminEx',root,
function ( )
 local T = {}
 for i,aAcc in ipairs ( getAccounts ( ) ) do
  local Acc1 = getAccountName( aAcc )
  table.insert ( T, Acc1 ) 
 end
 triggerClientEvent( source,"Acconts",source, T)
end
)

 


addEvent("aAdminEx1",true ) 
addEventHandler("aAdminEx1",root,
    function ( player1,editdays,editsbab)
	  local acc = getAccount(player1)
	  if acc and not isGuestAccount(acc) then
      local account = getAccountName(acc)
          if account then	
            if isObjectInACLGroup ( "user."..account, aclGetGroup ( Group) ) then  outputChatBox ( "#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff  الرتبه موجوده مسبقاً #ff0000 : خطاً",source, 255, 255, 255, true )	 return end 
             aclGroupAddObject (aclGetGroup( Group ), "user."..account)
               outputChatBox ( "#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff  يوم  [ #ff0000"..editdays.." #ffffff]   تم صك الاعب مخالفه لمدة ",source, 255, 255, 255, true )	
                 local Mn = executeSQLQuery("SELECT * FROM aAdminSystem WHERE account=?", account )
                   if ( Mn ) then		  
                    executeSQLQuery ( "INSERT INTO aAdminSystem(account,editdays,editsbab) VALUES(?,?,?)",account,editdays,editsbab )  		   
				      triggerClientEvent( root,"aGrid",root, account,editdays,editsbab)
			
			
              setTimer ( function (account)
                if not isObjectInACLGroup ( "user."..account, aclGetGroup ( Group ) ) then 
				executeSQLQuery("DELETE FROM aAdminSystem WHERE account=?", account) 
				triggerClientEvent(root,"datasCallBack",root)
				outputChatBox ( "#ff0000x[#2EFEF7 System Admin Ex #ff0000]x : #ffffff  الرتبه ليست موجوده #ff0000 : خطاً",source, 255, 255, 255, true )	 return end 
                 aclGroupRemoveObject ( aclGetGroup( Group ),"user."..account )
				 executeSQLQuery("DELETE FROM aAdminSystem WHERE account=?", account)
                 triggerClientEvent(root,"data",root)				 
               end,editdays*1000*60*60*24,1,account)
           end
		end
	 end
  end
)

addEvent("removeAdminEx",true)
addEventHandler("removeAdminEx",root,
function(players2) 
 if not isObjectInACLGroup ( "user."..players2, aclGetGroup ( Group ) ) then  
  executeSQLQuery("DELETE FROM aAdminSystem WHERE account=?", players2)
 else	
  aclGroupRemoveObject ( aclGetGroup( Group ),"user."..players2 )
   executeSQLQuery("DELETE FROM aAdminSystem WHERE account=?", players2)
    triggerClientEvent(root,"data",root)	
   end
 end 
)

addEvent("getDatas",true)
addEventHandler("getDatas",root,
function()
    local query = executeSQLQuery("SELECT * FROM aAdminSystem")
    triggerClientEvent(root,"datasCallBack",root,query)
end
)
 
addEvent ( 'removeaAdminSystem', true )
addEventHandler ( 'removeaAdminSystem', root, function (  )
   executeSQLQuery('DROP TABLE aAdminSystem' )
     local accountTable = getAccounts ()
      for i,v in ipairs ( accountTable ) do
	  local Acc2 = getAccountName( v )
       if isObjectInACLGroup ( "user."..Acc2, aclGetGroup ( Group ) ) then   	
        aclGroupRemoveObject ( aclGetGroup( Group ),"user."..Acc2 )
         triggerClientEvent(root,"data1",root)
		  MnHmAr1 (  )
	   end
    end	 
 end
)
 



addCommandHandler ( MnHmAr,
    function ( p )
        local acc = getPlayerAccount(p)
		
        if not isGuestAccount ( acc ) then
		
            if isObjectInACLGroup("user." .. getAccountName(acc), aclGetGroup(GroupOpen)) then
			
                triggerClientEvent ( p, "Open", resourceRoot )			
            end
        end
    end
)

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...