Dr.Xen Posted January 29, 2014 Share Posted January 29, 2014 السلام عليكم ورحمة الله وبركاته.. ابيكم تعدلو الكود تخلوه يحفظ السريال حتى لو سويت ريستاارت للسيرفر.. وتخلوه كذا انا لمن احط السبب يجي بالقائمة وععند الأعب نفس السبب الي حطيت.. 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
3NAD Posted January 29, 2014 Share Posted January 29, 2014 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
Dr.Xen Posted January 29, 2014 Author Share Posted January 29, 2014 جاري التجرب+ مشكور على الرد السريع Link to comment
Dr.Xen Posted January 29, 2014 Author Share Posted January 29, 2014 كذا صح ؟ 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
Dr.Xen Posted January 29, 2014 Author Share Posted January 29, 2014 سويت كذا بس ما زبط ماتفتح اللوحة ذذ Link to comment
3NAD Posted January 29, 2014 Share Posted January 29, 2014 في اف8 bl تأكد انك في قروب كونسول واكتب كلمة Link to comment
Dr.Xen Posted January 29, 2014 Author Share Posted January 29, 2014 يب انا في قروب Console!@ Link to comment
TAPL Posted January 29, 2014 Share Posted January 29, 2014 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
Dr.Xen Posted January 30, 2014 Author Share Posted January 30, 2014 ابي زر مسح للكونسل فقط ! والباقية للكل Link to comment
Mando Posted January 30, 2014 Share Posted January 30, 2014 المود حق ابو شنب لية مكتوب كدا By Dr.anAs والله انا اكره الناس دي Link to comment
Dr.Xen Posted January 30, 2014 Author Share Posted January 30, 2014 انا كاتبه علشان بسيرفري والي نزلت بالمنتتدى وزارهـ تقدر تروح تشوفه بإسم ابو شنب ! Link to comment
Simba Posted February 1, 2014 Share Posted February 1, 2014 انا كاتبه علشان بسيرفري والي نزلت بالمنتتدى وزارهـ تقدر تروح تشوفه بإسم ابو شنب ! تغير الحقوق ها ؟؟ 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