Jump to content

سؤال


Recommended Posts

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

كيف؟
هاذي الاكواد
 

xAddToGroupFunction_ = function ( Group,Price )
	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,0,255,255,true); end
    local sValue = getElementData( source,'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("* تم شراء الرتبة",source,255,0,0,true)
	else
		outputChatBox("* لا تملك ساعات كافية",source,0,255,255,true)
    end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)

 

Link to comment

حياك الله ..
تفضل
 

xAddToGroupFunction_ = function ( Group,Price )
	local account = getAccountName(getPlayerAccount(source));
    if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("* عليك ان تقوم بتسجيل الدخول اولا",source,255,0,0,true); end
	  if isObjectInACLGroup("user."..account, aclGetGroup(tostring("admin-ex-rank-name"))) then return outputChatBox("* لا يمكنك شراء رتبة وانت مخالف",source,255,0,0,true) end
	if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("* لديك هذه الرتبة بالفعل",source,0,255,255,true) end
    local sValue = getElementData( source,'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
	aclGroupRemoveObject (aclGetGroup("RankName"), "user."..account) -- تحط إسم الرتبة الي تبيها تنحذف RankName مكان
		aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
		outputChatBox("* تم شراء الرتبة",source,255,0,0,true)
	else
		outputChatBox("* لا تملك ساعات كافية",source,0,255,255,true)
    end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)

و مكان 
 

aclGroupRemoveObject (aclGetGroup("RankName"), "user."..account)

لو تبي تضيف كمان رتب عشان تنحذف ,
فقط تكرر السطر وتحط ب كل سطر أسماء الرتب الي بالمود ..
حياك الله
لا تنسى تغير اسم الرتبة واسم رتبة المخالف .
بالتوفيقق ..

  • Thanks 1
Link to comment
1 minute ago, AbU - W6N said:

حياك الله ..
تفضل
 


xAddToGroupFunction_ = function ( Group,Price )
	local account = getAccountName(getPlayerAccount(source));
    if isGuestAccount(getPlayerAccount(source)) then return outputChatBox("* عليك ان تقوم بتسجيل الدخول اولا",source,255,0,0,true); end
	  if isObjectInACLGroup("user."..account, aclGetGroup(tostring("admin-ex-rank-name"))) then return outputChatBox("* لا يمكنك شراء رتبة وانت مخالف",source,255,0,0,true) end
	if isObjectInACLGroup("user."..account, aclGetGroup(tostring(Group))) then return outputChatBox("* لديك هذه الرتبة بالفعل",source,0,255,255,true) end
    local sValue = getElementData( source,'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
	aclGroupRemoveObject (aclGetGroup("RankName"), "user."..account) -- تحط إسم الرتبة الي تبيها تنحذف RankName مكان
		aclGroupAddObject (aclGetGroup( tostring(Group)),"user."..account);
		outputChatBox("* تم شراء الرتبة",source,255,0,0,true)
	else
		outputChatBox("* لا تملك ساعات كافية",source,0,255,255,true)
    end
end
addEvent("Accept:the:request",true)
addEventHandler("Accept:the:request",root,xAddToGroupFunction_)

و مكان 
 


aclGroupRemoveObject (aclGetGroup("RankName"), "user."..account)

لو تبي تضيف كمان رتب عشان تنحذف ,
فقط تكرر السطر وتحط ب كل سطر أسماء الرتب الي بالمود ..
حياك الله
لا تنسى تغير اسم الرتبة واسم رتبة المخالف .
بالتوفيقق ..

شكراا راح اجربها

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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