Jump to content

تعديل مود ابو شنب


Dr.Xen

Recommended Posts

السلام عليكم ورحمة الله وبركاته..

ابيكم تعدلو الكود تخلوه يحفظ السريال حتى لو سويت ريستاارت للسيرفر..

وتخلوه كذا انا لمن احط السبب يجي بالقائمة وععند الأعب نفس السبب الي حطيت..

function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
GUIEditor = { 
    gridlist = {}, 
    window = {}, 
    edit = {}, 
    label = {}, 
    button = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0.22, 0.19, 0.57, 0.63, "=[ Black List  By Dr.anAs ]=", true) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1], false) 
        guiWindowSetMovable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
        guiSetProperty(GUIEditor.window[1], "CaptionColour", "FFBA9742") 
        GUIEditor.gridlist[1] = guiCreateGridList(48, 42, 362, 274, false, GUIEditor.window[1]) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "Name | الاسم", 0.40) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "Serial | السريال", 0.40) 
        guiGridListAddColumn(GUIEditor.gridlist[1], "Reason | السبب", 0.40) 
        GUIEditor.button[1] = guiCreateButton(48, 332, 160, 35, "=[ اضافة ]=", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(426, 26, 18, 22, "X", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFC0000") 
        GUIEditor.button[3] = guiCreateButton(250, 332, 160, 35, "=[ مسح ]=", false, GUIEditor.window[1]) 
        GUIEditor.window[2] = guiCreateWindow(0.25, 0.22, 0.49, 0.56, "=[ اضافة سريال | Add Serial ]=", true) 
        guiSetVisible(GUIEditor.window[2], false) 
        guiWindowSetSizable(GUIEditor.window[2], false) 
        guiWindowSetMovable(GUIEditor.window[2], false) 
        guiSetAlpha(GUIEditor.window[2], 1.00) 
        GUIEditor.label[1] = guiCreateLabel(84, 28, 239, 16, "* Write The Serial Here | اكتب السريال هنا :", false, GUIEditor.window[2]) 
        GUIEditor.button[4] = guiCreateButton(127, 271, 166, 35, "=[ اضافة ]=", false, GUIEditor.window[2]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF3DFD01") 
        GUIEditor.edit[1] = guiCreateEdit(80, 60, 248, 39, "", false, GUIEditor.window[2]) 
        GUIEditor.button[5] = guiCreateButton(364, 23, 23, 27, "X", false, GUIEditor.window[2]) 
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFE0000") 
        GUIEditor.label[2] = guiCreateLabel(84, 103, 239, 16, "* Write The Name Here | اكتب الاسم هنا :", false, GUIEditor.window[2]) 
        GUIEditor.edit[2] = guiCreateEdit(80, 129, 248, 39, "", false, GUIEditor.window[2]) 
        GUIEditor.label[3] = guiCreateLabel(84, 178, 239, 16, "* Write The Reason | اكتب سبب الباند هنا :", false, GUIEditor.window[2]) 
        GUIEditor.edit[3] = guiCreateEdit(80, 204, 248, 39, "", false, GUIEditor.window[2]) 
    end 
) 
  
addEvent("show",true) 
addEventHandler("show",root,function() 
if not ( guiGetVisible(GUIEditor.window[1]) ) then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
triggerServerEvent("getall",localPlayer) 
triggerServerEvent("getall",localPlayer) 
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end 
end) 
  
addEvent("add",true) 
addEventHandler("add",root,function(serial,name,reason,i) 
guiGridListAddRow(GUIEditor.gridlist[1]) 
guiGridListSetItemText(GUIEditor.gridlist[1], i, 1, name, false, false) 
guiGridListSetItemColor(GUIEditor.gridlist[1], i, 1, 0, 255, 0, 255) 
guiGridListSetItemText(GUIEditor.gridlist[1], i, 2, serial, false, false) 
guiGridListSetItemColor(GUIEditor.gridlist[1], i, 2, 255, 0, 0, 255) 
guiGridListSetItemText(GUIEditor.gridlist[1], i, 3, reason, false, false) 
guiGridListSetItemColor(GUIEditor.gridlist[1], i,3, 0, 0, 255, 255) 
end) 
  
addEvent("clear",true) 
addEventHandler("clear",root,function() 
guiGridListClear(GUIEditor.gridlist[1]) 
end) 
  
addEventHandler("onClientGUIClick",root,function() 
if ( source == GUIEditor.button[1] ) then 
guiSetVisible(GUIEditor.window[1], false) 
guiSetVisible(GUIEditor.window[2], true) 
showCursor(true) 
elseif ( source == GUIEditor.button[2] ) then 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
elseif ( source == GUIEditor.button[3] ) then 
if ( guiGridListGetSelectedItem(GUIEditor.gridlist[1]) ~= -1 ) then 
local serial = guiGridListGetItemText ( GUIEditor.gridlist[1], guiGridListGetSelectedItem ( GUIEditor.gridlist[1] ), 2 ) 
triggerServerEvent("deleteserial",localPlayer,serial) 
else 
outputChatBox("* Please Select Serial To Delete",255,0,0,true) 
end 
elseif ( source == GUIEditor.button[4] ) then 
if ( guiGetText(GUIEditor.edit[1]) == "" or guiGetText(GUIEditor.edit[1]) == " " ) then return end 
if ( guiGetText(GUIEditor.edit[2]) == "" or guiGetText(GUIEditor.edit[2]) == " " ) then return end 
if ( guiGetText(GUIEditor.edit[3]) == "" or guiGetText(GUIEditor.edit[3]) == " " ) then return end 
triggerServerEvent("addserial",localPlayer,guiGetText(GUIEditor.edit[1]),guiGetText(GUIEditor.edit[2]),guiGetText(GUIEditor.edit[3])) 
elseif ( source == GUIEditor.button[5] ) then 
guiSetVisible(GUIEditor.window[2], false) 
showCursor(false) 
end 
end) 
  
addEvent("hidemain",true) 
addEventHandler("hidemain",root,function() 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end) 
  
addEvent("hide",true) 
addEventHandler("hide",root,function() 
guiSetVisible(GUIEditor.window[2], false) 
showCursor(false) 
end) 
  

getSerials = function() 
  local Row = executeSQLQuery("SELECT * FROM blacklist_new") 
  if (type(Row) == "table" and #Row == 0) or not Row then 
    return {} 
  else 
    return Row 
  end 
end 
  
isSerialInBlack = function(serial) 
  local Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = ?", tostring(serial)) 
  if (type(Row) == "table" and #Row == 0) or not Row then 
    return false 
  else 
    return true 
  end 
end 
  
addEventHandler("onResourceStart",resourceRoot,function() 
executeSQLQuery("CREATE TABLE IF NOT EXISTS blacklist_new (serial,name,reason)") 
for i,v in ipairs ( getElementsByType("player") ) do 
if not ( isGuestAccount(getPlayerAccount(v)) ) then 
if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Console")) ) then 
addCommandHandler("bl",function(player) 
triggerClientEvent(player,"show",player) 
end) 
end 
end 
end 
end) 
  
addEventHandler("onPlayerLogin",root,function() 
if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) ) then 
addCommandHandler("bl",function(player) 
triggerClientEvent(player,"show",player) 
end) 
end 
end) 
  
addEvent("getall",true) 
addEventHandler("getall",root,function() 
for i,v in ipairs ( getSerials() ) do 
triggerClientEvent(source,"add",source,v.serial,v.name,v.reason,i) 
end 
end) 
  
  
addEvent("addserial",true) 
addEventHandler("addserial",root,function(serial,name,reason) 
Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = '"..tostring(serial).."'") 
if ( #Row == 0 )   then 
executeSQLQuery("INSERT INTO blacklist_new(serial,name,reason) VALUES('"..tostring(serial).."','"..tostring(name).."','"..tostring(reason).."')") 
triggerClientEvent(source,"hide",source) 
else 
outputChatBox("* This Serial In Black List",source,255,0,0,true) 
triggerClientEvent(source,"hide",source) 
end 
end) 
  
addEvent("deleteserial",true) 
addEventHandler("deleteserial",root,function(serial) 
executeSQLQuery("DELETE FROM blacklist_new WHERE serial=?", serial) 
outputChatBox("* This Serial Was Deleted",source,255,0,0,true) 
triggerClientEvent(source,"hidemain",source) 
triggerClientEvent(source,"clear",source) 
end) 
  
addEventHandler("onPlayerConnect",root,function(_,_,_,serial) 
if ( isSerialInBlack(serial) ) then 
cancelEvent(true,"You Are In Black List !") 
end 
end) 
  

Link to comment
addEventHandler("onPlayerConnect",root,function(_,_,_,serial) 
    if ( isSerialInBlack(serial) ) then 
        local database = executeSQLQuery ( "SELECT `reason` FROM `blacklist_new` WHERE `serial` =?", serial ) 
        if database[1].reason then 
            cancelEvent(true,"You Are In Black List ("..database[1].reason..").") 
        else 
            cancelEvent(true,"You Are In Black List !") 
        end 
    end 
end)     

Link to comment

كذا صح ؟

    getSerials = function() 
      local Row = executeSQLQuery("SELECT * FROM blacklist_new") 
      if (type(Row) == "table" and #Row == 0) or not Row then 
        return {} 
      else 
        return Row 
      end 
    end 
      
    isSerialInBlack = function(serial) 
      local Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = ?", tostring(serial)) 
      if (type(Row) == "table" and #Row == 0) or not Row then 
        return false 
      else 
        return true 
      end 
    end 
      
    addEventHandler("onResourceStart",resourceRoot,function() 
    executeSQLQuery("CREATE TABLE IF NOT EXISTS blacklist_new (serial,name,reason)") 
    for i,v in ipairs ( getElementsByType("player") ) do 
    if not ( isGuestAccount(getPlayerAccount(v)) ) then 
    if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Console")) ) then 
    addCommandHandler("bl",function(player) 
    triggerClientEvent(player,"show",player) 
    end) 
    end 
    end 
    end 
    end) 
      
    addEventHandler("onPlayerLogin",root,function() 
    if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Console")) ) then 
    addCommandHandler("bl",function(player) 
    triggerClientEvent(player,"show",player) 
    end) 
    end 
    end) 
      
    addEvent("getall",true) 
    addEventHandler("getall",root,function() 
    for i,v in ipairs ( getSerials() ) do 
    triggerClientEvent(source,"add",source,v.serial,v.name,v.reason,i) 
    end 
    end) 
      
      
    addEvent("addserial",true) 
    addEventHandler("addserial",root,function(serial,name,reason) 
    Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = '"..tostring(serial).."'") 
    if ( #Row == 0 )   then 
    executeSQLQuery("INSERT INTO blacklist_new(serial,name,reason) VALUES('"..tostring(serial).."','"..tostring(name).."','"..tostring(reason).."')") 
    triggerClientEvent(source,"hide",source) 
    else 
    outputChatBox("* This Serial In Black List",source,255,0,0,true) 
    triggerClientEvent(source,"hide",source) 
    end 
    end) 
      
    addEvent("deleteserial",true) 
    addEventHandler("deleteserial",root,function(serial) 
    executeSQLQuery("DELETE FROM blacklist_new WHERE serial=?", serial) 
    outputChatBox("* This Serial Was Deleted",source,255,0,0,true) 
    triggerClientEvent(source,"hidemain",source) 
    triggerClientEvent(source,"clear",source) 
    end) 
      
    addEventHandler("onPlayerConnect",root,function(_,_,_,serial) 
        if ( isSerialInBlack(serial) ) then 
            local database = executeSQLQuery ( "SELECT `reason` FROM `blacklist_new` WHERE `serial` =?", serial ) 
            if database[1].reason then 
                cancelEvent(true,"You Are In Black List ("..database[1].reason..").") 
            else 
                cancelEvent(true,"You Are In Black List !") 
            end 
        end 
    end)     
      

Link to comment
    getSerials = function() 
      local Row = executeSQLQuery("SELECT * FROM blacklist_new") 
      if (type(Row) == "table" and #Row == 0) or not Row then 
        return {} 
      else 
        return Row 
      end 
    end 
      
    isSerialInBlack = function(serial) 
      local Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = ?", tostring(serial)) 
      if (type(Row) == "table" and #Row == 0) or not Row then 
        return false 
      else 
        return true 
      end 
    end 
      
    addEventHandler("onResourceStart", resourceRoot, 
    function() 
        executeSQLQuery("CREATE TABLE IF NOT EXISTS blacklist_new (serial,name,reason)") 
    end) 
      
  
    addCommandHandler("bl",function(player) 
        if ( isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Console")) ) then 
            triggerClientEvent(player,"show",player) 
        end 
    end) 
      
    addEvent("getall",true) 
    addEventHandler("getall",root,function() 
    for i,v in ipairs ( getSerials() ) do 
    triggerClientEvent(source,"add",source,v.serial,v.name,v.reason,i) 
    end 
    end) 
      
      
    addEvent("addserial",true) 
    addEventHandler("addserial",root,function(serial,name,reason) 
    Row = executeSQLQuery("SELECT * FROM blacklist_new WHERE serial = '"..tostring(serial).."'") 
    if ( #Row == 0 )   then 
    executeSQLQuery("INSERT INTO blacklist_new(serial,name,reason) VALUES('"..tostring(serial).."','"..tostring(name).."','"..tostring(reason).."')") 
    triggerClientEvent(source,"hide",source) 
    else 
    outputChatBox("* This Serial In Black List",source,255,0,0,true) 
    triggerClientEvent(source,"hide",source) 
    end 
    end) 
      
    addEvent("deleteserial",true) 
    addEventHandler("deleteserial",root,function(serial) 
    executeSQLQuery("DELETE FROM blacklist_new WHERE serial=?", serial) 
    outputChatBox("* This Serial Was Deleted",source,255,0,0,true) 
    triggerClientEvent(source,"hidemain",source) 
    triggerClientEvent(source,"clear",source) 
    end) 
      
    addEventHandler("onPlayerConnect",root,function(_,_,_,serial) 
        if ( isSerialInBlack(serial) ) then 
            local database = executeSQLQuery ( "SELECT `reason` FROM `blacklist_new` WHERE `serial` =?", serial ) 
            if database[1].reason then 
                cancelEvent(true,"You Are In Black List ("..database[1].reason..").") 
            else 
                cancelEvent(true,"You Are In Black List !") 
            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...