@Kara
كيف مافيها غلط والسورس مب معرف ؟
كلينت :
--- client
local Key = "F7"
local Admin = {
{"رئيس حرب ليبيا","libyawar_lv8","320"},
{"نائب رئيس حرب ليبيا","libyawar_lv7","270"},
{"رئيس الحكومه","libyawar_lv6","230"},
{"قائد القوات الخاصه","libyawar_lv5","180"},
{"قائد المليشيات المسلحة","libyawar_lv4","150"},
{"قــائـد الحرب","libyawar_lv3","90"},
{"لواء","libya_war_lv2","60"},
{"امر كتيبة","libya_war_lv1","30"},
{"مرشح للحرب","libyawae0","15"},
}
----------------------
-- Setting
----------------------
local font0_LLK = guiCreateFont("LLK.ttf", 11)
local font1_LLK = guiCreateFont("LLK.ttf", 13)
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] = guiCreateStaticImage(268, 212, 489, 350, "LK.png", false);
GUIEditorlabel = guiCreateLabel(130, 4, 221, 27, "لوحة شراء الرتب حرب ليبيت | By :Ismaeel", false, GiveAdmin.Window[1]);
guiSetFont(GUIEditorlabel, font1_LLK);
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");
guiLabelSetColor(GiveAdmin.label[1], 255, 0, 0)
GiveAdmin.gridlist[1] = guiCreateGridList(14, 48, 461, 222, false, GiveAdmin.Window[1]);
guiGridListAddColumn(GiveAdmin.gridlist[1], "#", 0.15)
guiGridListAddColumn(GiveAdmin.gridlist[1], "الرتبة", 0.35);
guiGridListAddColumn(GiveAdmin.gridlist[1], "القروب", 0.25);
guiGridListAddColumn(GiveAdmin.gridlist[1], "الساعات", 0.15);
GiveAdmin.button[1] = guiCreateButton(14, 280, 461, 56, " | [ لوحة شرآء رتب ] | ", false, GiveAdmin.Window[1]);
guiSetFont(GiveAdmin.button[1], font0_LLK);
guiSetProperty(GiveAdmin.button[1], "NormalTextColour", "FF24AAFF");
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,234,234,234);
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,2,67,200,255)
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,3,234,234,234);
guiGridListSetItemColor(GiveAdmin.gridlist[1],row,4,67,200,255);
guiSetFont(GiveAdmin.gridlist[1], font0_LLK);
end
function xMainFunctions_ ( )
local row, col = guiGridListGetSelectedItem ( GiveAdmin.gridlist[1] )
local Name = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,1 ));
local Group = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,2 ));
local Price = tostring ( guiGridListGetItemText(GiveAdmin.gridlist[1],row,3 ));
if ( row and col and row ~= -1 and col ~= -1 ) then
triggerServerEvent("Accept:the:request",localPlayer,localPlayer,Group,Price,Name);
else
outputChatBox("* الرجاء اختيار رتبةة !",255,0,0,true);
end
end
addEventHandler("onClientGUIClick",GiveAdmin.button[1],xMainFunctions_);
xBindFunction_ = function ()
guiSetVisible(GiveAdmin.Window[1],not guiGetVisible(GiveAdmin.Window[1]));
showCursor(guiGetVisible(GiveAdmin.Window[1]));
end
bindKey(Key,"down",xBindFunction_);
سيرفر :
function xAddToGroupFunction_ ( Player,Group,Price,Name )
local account = getAccountName(getPlayerAccount(Player));
if isGuestAccount(getPlayerAccount(Player)) then return outputChatBox(" * يجب عليك التسجيل اولاَ",Player,255,0,255,true); end
if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("** لديك هذهـ الرتبة فعـلا ! ",Player,255,0,255,true); end
local sValue = getElementData( Player,'PlayTime' )
if not sValue then sValue = '0:0:0' end
local data = split(sValue,':')
local hour = tonumber( data[1] )
if hour == nil or not tonumber(hour) then hour = 0 end
if ( hour >= tonumber(Price)) then
aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
outputChatBox("** تم اضافة الرتبة بنجاح | "..Name,Player,0,255,255,true);
else
outputChatBox("**ليس لديك ساعات كافية",Player,255,0,0,true);
end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)
ملاحظة: الكود ما جربته, جربه أنت وشوف الديبوق مثل ما قالوا لك الأخوان فوق