xAddToGroupFunction_ = function ( Group,Price,Name )
local account = getAccountName(getPlayerAccount(source));
if isGuestAccount(getPlayerAccount(source)) then return outputChatBox(" * يجب عليك التسجيل اولاَ",source,255,0,255,true); end
if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("** لديك هذهـ الرتبة فعـلا ! ",source,255,0,255,true); end
local sValue = getElementData( source,'Level' )
if not sValue then sValue = '0' end
local data = tonumber(string.sub(sValue, 6)) local hour = tonumber( data )
if hour == nil or not tonumber(hour) then hour = 0 end
if not isObjectInACLGroup("user."..account, aclGetGroup(tostring("ExAdmin"))) then
if ( hour >= tonumber(Price)) then
removeGroups(source);
aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
outputChatBox("** تم اضافة الرتبة بنجاح | "..Name,source,0,255,255,true);
else
outputChatBox("**ليس لديك لفلات كافية",source,255,0,0,true);
end
else
outputChatBox("**لا يمكنك شراء رتبة لأنك مخالف",source,255,0,0,true);
end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)
function removeGroups ( element )
if ( element and isElement ( element ) ) then
if ( getPlayerAccount ( element ) and not isGuestAccount ( getPlayerAccount ( element ) ) ) then
for _, v in ipairs ( aclGroupList ( ) ) do
if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( element ) ), v ) ) then
aclGroupRemoveObject ( v, "user." .. getAccountName ( getPlayerAccount ( element ) ) )
end
end
end
end
end