الكلينت
local Admin = {
{"Level_1","Level_1","100"},
{"Level_2","Level_2","250"},
{"Level_3","Level_3","500"},
{"Level_4","Level_4","1250"},
{"Level_5","Level_5","3000"},
{"Leader","Leader","5000"},
{"HeadLeaDer","HeadLeaDer","8000"},
{"ADMIN","ADMIN","15000"},
{"HEAD-ADMIN","HEAD-ADMIN","10000"},
{"SuPeR-ADMIN","SuPeR-ADMIN","20000"},
{"BIG-ADMIN","BIG-ADMIN","35000"},
{"GA-1","GA-1","42000"},
{"GA-2","GA-2","50000"},
{"GM-1","GM-1","75000"},
{"GM-2","GM-2","105000"},
{"SUPPORT","SUPPORT","120000"},
{"ProAdmin","ProAdmin","130000"},
{"cOwner","cOwner","155000"},
{"cOwner1","cOwner1","165000"},
{"cOwner2","cOwner2","175500"},
{"cOwner3","cOwner3","185000"},
{"cOwner4","cOwner4","195000"},
{"cOwner5","cOwner5","205000"},
}
----------------------
-- Setting
----------------------
GiveAdmin = {
Window = {},
gridlist = {},
button = {},
label = {},
}
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
GiveAdmin.Window[1] = guiCreateWindow(445, 132, 310, 339, "==[ شراء رتبة ]==", false);
centerWindow(GiveAdmin.Window[1]);
guiSetVisible(GiveAdmin.Window[1],false);
guiWindowSetSizable(GiveAdmin.Window[1], false);
guiSetAlpha(GiveAdmin.Window[1], 1.00);
guiSetProperty(GiveAdmin.Window[1], "CaptionColour", "FF0383FB");
GiveAdmin.label[1] = guiCreateLabel(8, 19, 411, 33, "مرحبا بك في نظام شراء الرتب الرجاء اختيار الرتبة ادناهـ :", false, GiveAdmin.Window[1]);
guiSetFont(GiveAdmin.label[1], "default-bold-small")
guiLabelSetColor(GiveAdmin.label[1], 255, 0, 0)
GiveAdmin.gridlist[1] = guiCreateGridList(9, 51, 294, 236, false, GiveAdmin.Window[1]);
guiGridListAddColumn(GiveAdmin.gridlist[1], "#", 0.2)
guiGridListAddColumn(GiveAdmin.gridlist[1], "الرتبة", 0.2);
guiGridListAddColumn(GiveAdmin.gridlist[1], "القروب", 0.2);
guiGridListAddColumn(GiveAdmin.gridlist[1], "السكور", 0.2);
GiveAdmin.button[1] = guiCreateButton(18, 302, 115, 26, "شراء الرتبة", false, GiveAdmin.Window[1]);
guiSetFont(GiveAdmin.button[1], "default-bold-small");
guiSetProperty(GiveAdmin.button[1], "NormalTextColour", "FFF5FF00");
GiveAdmin.button[2] = guiCreateButton(186, 302, 115, 26, "اغلاق", false, GiveAdmin.Window[1]);
guiSetFont(GiveAdmin.button[2], "default-bold-small");
guiSetProperty(GiveAdmin.button[2], "NormalTextColour", "FFF5FF00");
for k,v in ipairs ( Admin ) do
row = guiGridListAddRow(GiveAdmin.gridlist[1]);
guiGridListSetItemText(GiveAdmin.gridlist[1],row,1,''..k..'-',false,false);
guiGridListSetItemText(GiveAdmin.gridlist[1],row,2,v[1],false,false);
guiGridListSetItemText(GiveAdmin.gridlist[1],row,3,v[2],false,false);
guiGridListSetItemText(GiveAdmin.gridlist[1],row,4,v[3],false,false);
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,1,255,255,0);
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,2,0,255,0)
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,3,255,255,0);
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,4,0,255,0);
guiSetFont(GiveAdmin.gridlist[1],"default-bold-small");
end
xMainFunctions_ = function ( )
local row, col = guiGridListGetSelectedItem ( GiveAdmin.gridlist[1] )
local Group = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,3 ));
local Price = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,4 ));
local Name = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,2 ));
if ( row and col and row ~= -1 and col ~= -1 ) then
triggerServerEvent("Accept:the:request",localPlayer,Group,Price,Name);
else
outputChatBox("* الرجاء اختيار رتبةة !",255,0,0,true);
end
end
addEventHandler("onClientGUIClick",GiveAdmin.button[1],xMainFunctions_,false);
xCloseFunctions_ = function ( )
guiSetVisible (GiveAdmin.Window[1], false )
showCursor ( false )
end
addEventHandler("onClientGUIClick",GiveAdmin.button[2],xCloseFunctions_,false);
Markers ={
{202.15210, 1882.76294 , 17.64806},
{356.09140, -2084.93506, 2.30000}
}
for i,v in ipairs (Markers) do
marker = createMarker(v[1], v[2], v[3] -1, "cylinder", 2, 255,0,0,255)
end
addEventHandler ( "onClientMarkerHit", resourceRoot,
function ( player )
if player == localPlayer then
guiSetVisible (GiveAdmin.Window[1], true )
showCursor ( true )
end
end
)
السيرفر
xAddToGroupFunction_ = function ( Group,Price,Name )
local account = getAccountName(getPlayerAccount(source));
if isGuestAccount(getPlayerAccount(source)) then return outputChatBox(" * يجب عليك التسجيل اولاَ",source,255,0,0,true); end
if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("** لديك هذهـ الرتبة فعـلا ! ",source,255,0,0,true); end
if ( getElementData(source, "Zombie kills") >= tonumber(Price)) then
aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
outputChatBox("** تم شراء الرتبة بـ نجاحح | "..Name.." | ",source,0,255,0,true);
local res = getResourceFromName ( "admin" )
if getResourceState(res) == "running" then
restartResource(res)
end
else
outputChatBox("لا تملك السكور الكافي",source,255,0,0,true);
end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)
بدي مثلن لما يكون رتبته 1 وشرا لفل 2 يحذف رتبته القديمه ويعطيه الرتبه الجديده