Jump to content

مساعدة ضروري #


#Prov

Recommended Posts

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

عندي مود اسـل وابي الي يسحب رتبة الكونسل + ادمن يـنصك باند وما احد يقدر يرقي نفسه كونسل وادمن

 

- الخادم








-- get groups
addEvent("getGroups",true)
addEventHandler("getGroups",root,
    function ()
	groups = {}
	        for i,group in ipairs(aclGroupList()) do -- get all groups
            table.insert(groups,aclGroupGetName(group))
			end
               for i,v in ipairs(groups) do -- get all groups in table
		        triggerClientEvent(source,"addGroups",source,v)
				end
		    end
)


--  add player to chosen group
addEvent("add_g",true)
addEventHandler("add_g",root,
    function (splayer,sgroup)
	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup(allowedGroup)) then
		if not isGuestAccount(getPlayerAccount(getPlayerFromName(tostring(splayer)))) then
		aclGroupAddObject (aclGetGroup(sgroup), "user."..getAccountName(getPlayerAccount(getPlayerFromName(splayer))))
		outputChatBox("* "..splayer.." successfully added to "..sgroup.."",source,0,255,0)
		outputChatBox("* You've been added to "..sgroup.." by "..getPlayerName(source).."",getPlayerFromName(splayer),0,255,0)
		else
		outputChatBox("* You can't add "..splayer.." to "..sgroup.." because he is not logged in",source,255,0,0)
		end
	else
	outputChatBox("* You don't have rights to do this.",source,255,0,0)
	outputDebugString("* "..getPlayerName(source).." had attempted to hack the server",2)
	end
end
)
-- remove player from chosen group
addEvent("remove_g",true)
addEventHandler("remove_g",root,
    function (splayer,sgroup)
	if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)),aclGetGroup(allowedGroup)) then
		if not isGuestAccount(getPlayerAccount(getPlayerFromName(tostring(splayer)))) then
		aclGroupRemoveObject (aclGetGroup(sgroup), "user."..getAccountName(getPlayerAccount(getPlayerFromName(splayer))))
		outputChatBox("* "..splayer.." successfully removed from "..sgroup.."",source,0,255,0)
		outputChatBox("* You've been removed from "..sgroup.."",getPlayerFromName(splayer),255,0,0)
		else
		outputChatBox("* You can't remove "..splayer.." from "..sgroup.." because he is not logged in",source,255,0,0)
		end
	else
	outputChatBox("* You don't have rights to do this.",source,255,0,0)
	outputDebugString("* "..getPlayerName(source).." had attempted to hack the server",2)
	end
end
)

--  give permission panel , open command
addCommandHandler("gpp",
function (player)
       if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup(allowedGroup)) then
	   triggerClientEvent(player,"show_gpp",player)
	   else
	  outputChatBox ( "ACL: Access denied for 'gpp'", player, 255, 168, 0 )
       end
end)

 

- Client

--[[
// copyrights //
Give Permissions Panel by SoRa
Notice : needs admin rights
// copyrights //
--]]

GUIEditor = {
    gridlist = {},
    button = {},
    label = {},
    window = {},
}
gpp = guiCreateWindow(126, 100, 535, 346, "Give Permissions Panel v 1.4 by SoRa", false)
guiSetVisible(gpp,false)
guiWindowSetSizable(gpp, false)
guiSetAlpha(gpp, 1.00)

pgrid = guiCreateGridList(34, 51, 225, 232, false, gpp)
pc = guiGridListAddColumn(pgrid, "Players :", 0.9)
GUIEditor.label[1] = guiCreateLabel(42, 25, 121, 19, "1 - Choose player :", false, gpp)
ggrid = guiCreateGridList(280, 51, 223, 232, false, gpp)
gc = guiGridListAddColumn(ggrid, "Groups :", 0.9)
GUIEditor.label[2] = guiCreateLabel(286, 25, 121, 19, "2 - Choose group  :", false, gpp)
add = guiCreateButton(45, 293, 202, 39, "اضافه الى", false, gpp)
guiSetProperty(add, "NormalTextColour", "FF00FF00")
remove = guiCreateButton(286, 293, 202, 39, "ازاله من ", false, gpp)
guiSetProperty(remove, "NormalTextColour", "FFFF0000")
x = guiCreateButton(502, 23, 20, 18, "X", false, gpp)



addEvent("show_gpp",true)
addEventHandler("show_gpp",root,
    function ()
	guiSetVisible(gpp,true)
	showCursor(true)
	clear()
	triggerServerEvent ("getGroups", getLocalPlayer())
	addPlayers()
	end
)


    function clear()
guiGridListClear (ggrid)
guiGridListClear (pgrid)
    end


addEvent("refreshg",true)
addEventHandler("refreshg",root,
    function ()
    clear()
	end
)

addEvent("addGroups",true)
addEventHandler("addGroups",root,
    function (v)
    guiGridListSetItemText ( ggrid, guiGridListAddRow ( ggrid ), gc,v, false, false )
	end
)



function addPlayers()
	for i,player in ipairs(getElementsByType("player")) do
			local row = guiGridListAddRow(pgrid)
			guiGridListSetItemText ( pgrid, row, pc, (string.gsub(getPlayerName(player),'#%x%x%x%x%x%x','') or getPlayerName(player)), false, false)
			guiGridListSetItemData ( pgrid, row, pc, getPlayerName(player))
	end
end

addEventHandler ( "onClientGUIClick",pgrid,
function ()
splayer = guiGridListGetItemText ( pgrid, guiGridListGetSelectedItem ( pgrid ), 1 )
sgroup = guiGridListGetItemText ( ggrid, guiGridListGetSelectedItem ( ggrid ), 1 )
guiSetText(add,"Add "..splayer.." To "..sgroup.."")
guiSetText(remove,"Remove "..splayer.." From "..sgroup.."")
end
)


addEventHandler ( "onClientGUIClick",ggrid,
function ()
splayer = guiGridListGetItemText ( pgrid, guiGridListGetSelectedItem ( pgrid ), 1 )
sgroup = guiGridListGetItemText ( ggrid, guiGridListGetSelectedItem ( ggrid ), 1 )
guiSetText(add,"Add "..splayer.." To "..sgroup.."")
guiSetText(remove,"Remove "..splayer.." From "..sgroup.."")
end)

function onGuiClick (button, state, absoluteX, absoluteY)
   if (source == add) then
    if splayer and sgroup then
	triggerServerEvent("add_g", getLocalPlayer(), guiGridListGetItemData(pgrid, guiGridListGetSelectedItem ( pgrid ), 1),sgroup)
	end
	elseif (source == remove) then
   if splayer and sgroup then
	triggerServerEvent("remove_g", getLocalPlayer(), guiGridListGetItemData(pgrid, guiGridListGetSelectedItem ( pgrid ), 1),sgroup)
	end
	elseif (source == x) then
	guiSetVisible(gpp,false)
	showCursor(false)
     end
end
addEventHandler ( 

 

Edited by #Prov
Link to comment

 

مثال على اضافة الحساب لأي قروب ما عدا ادمن و كونسل

 

_groups={
  'Console',
  'Admin',
} -- جدول يحتوي على قائمة القروبات الممنوع الترقية اليها


function setAccountAclGroup( splayer, sgroup )
  local acc = getPlayerAccount(splayer)
  local accName = getAccountName(acc)
  if isObjectInACLGroup('user.'..accName, aclGetGroup('Console')) then
    if _groups[1] ~= sgroup and _groups[2] ~= sgroup then
    	aclGroupAddObject(aclGetGroup(sgroup),'user.'..accName)
    else
        outputChatBox("You cannot insert this account to : "..sgroup, source)
    end
    return false
  end
end


function getGroups()
	for k, v in ipairs (_groups) do
  		return v
 	end
	return false
end

 

الآن تروح ملف ميتا عشان تعطي صلاحيات للدالة

getGroups

عشان تشتغل من خارج السكربت حقك

تروح ملف الميتا حقك وتكتب فيه السطر ذا

<export function="getGroups" type="server"/>

بعدها نكمل الخطوة الثانية اللي هي تبنيد اللاعب اذا سحب رتبة كونسل او ادمن

admin طبعاً لازم تعدل على سكربت 

لأن عملية سحب الرتبة تتم من خلاله بالنسبة لسيرفرك إذا عندك طريقة ثانية عشان تسحب الرتب لازم ترتب الطريقة هذي بحيث تتناسب مع طريقة برمجتك لسكربت سحب الرتب

مثال على تبنيد اللاعب في حالة إزالته لأي عنصر من رتبة كونسل او رتبة ادمن

راح تعتمد على الاكواد اللي عطيتك فوق لازم تطبقها بنفس الطريقة ولا ماراح يشتغل

 

أولاً راح تتوجه لسكربت ادمن

admin

MTA SA/mods/deathmatch/resources/[admin]/admin.zip

راح تسوي نسخ لهذا الملف وتحطه كنسخة احتياطيه في سطح المكتب

في حال واجهتك مشكلة ترجع تركبه

بعد ماتسوي نسخة احتياطية راح تدخل على المسار المذكور فوق ^

بعد ماتدخل على ملف ادمن

راح تجيك 3 مجلدات

client

conf

server

راح تدخل على

server

بعدين تجيك عدة ملفات

كل اللي يهمك الملف هذا :

admin_server.lua

تدخل عليه و استبدل الاكواد اللي من السطر 795 إلى 802

تجيك الأكواد كذا

				if ( not aclGroupRemoveObject ( group, object ) ) then
					action = nil
					outputChatBox ( "Error - object '"..tostring ( object ).."' does not exist in group '"..tostring ( arg[2] ).."'", source, 255, 0, 0 )
				else
					mdata2 = "Object '"..arg[3].."'"
					triggerEvent ( "aAdmin", source, "sync", "aclobjects", arg[2] )
				outputServerLog ("ACL: "..getPlayerName(source).."["..getAccountName (getPlayerAccount(source)).."] ["..getPlayerSerial (source).."] ["..getPlayerIP (source).."] removed "..mdata2)
				end

 

كل اللي عليك تستبدل هذول بالكود اللي تحت

				if group ~= exports.SCRIPTNAME:getGroups() then -- بإسم السكربت حقك SCRIPTNAME إستبدل 
					if ( not aclGroupRemoveObject ( group, object ) ) then
						action = nil
						outputChatBox ( "Error - object '"..tostring ( object ).."' does not exist in group '"..tostring ( arg[2] ).."'", source, 255, 0, 0 )
					else
						mdata2 = "Object '"..arg[3].."'"
						triggerEvent ( "aAdmin", source, "sync", "aclobjects", arg[2] )
					outputServerLog ("ACL: "..getPlayerName(source).."["..getAccountName (getPlayerAccount(source)).."] ["..getPlayerSerial (source).."] ["..getPlayerIP (source).."] removed "..mdata2)
					end
				else
					banPlayer(source)
				end

 

 

الأكواد المطروحة قد تختلف عن الاكواد اللي انت طارحها اختلاف متوسط 

لكنها تعطيك الطريقة المناسبة للوصول لطلبك

بإسم السكربت الخاص فيك SCRIPTNAME لاتنسى بعد ماتبدل الاكواد في ملف ادمن انك تبدل

في السطر 795 تحديداً داخل الجملة الشرطية

الأكواد غير مجربة + سوي نسخة إحتياطية لسكربت آدمن لأني غير مسؤول عن أي خطأ قد يحصل معك في الأكواد

بالتوفيق

Edited by NX_CI
  • Like 1
Link to comment
4 hours ago, #Prov said:

جربت خطواتك بالزبط ولوحة الادمن ما صارت تشتغل

تأكد انك ركبتها بشكل صحيح,,
أطرح أكواد الي عدلتها..

 

Link to comment
15 hours ago, #Prov said:

جربت خطواتك بالزبط ولوحة الادمن ما صارت تشتغل

سويت نسخة احتياطية ؟

اذا سويت خلها لا تركبها لين نشوف حل لمشكلتك اذا ضبطت خلاص احتفظ بالنسخه الاحتياطيه ولاتركبها

روح اف 8 و اكتب السطر اللي تحت

debugscript 3

و خذ صورة للشاشة و حطها عشان نشوف المشكلة

Link to comment
  • N3xT locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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