AR/addAccount

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

هذه الوظيفة تقوم بأضافة حساب جديد إلى قائمة الحسابات المسجلة في السيرفر.

Syntax

account addAccount ( string name, string pass )

العناصر المطلوبة

  • name: أسم الحساب الجديد اللذي تريد تسجيلة.
  • pass: كلمة المرور للحساب اللذي تريد تسجيلة.

Returns

إذا كان أسم هذا الحساب قد تم تسجيلة مسبقاً أو إذا حدث خطأ ما false يرجع عنصر الحساب اللذي تم تسجيلة, أو

مثال

Click to collapse [-]
Server

مثال 1 : /register <password> هذا يسمح للاعبين بالتسجيل في السيرفر عن طريق أستخدام

function registerPlayer(source, commandName, password)
	-- تحقق مما إذا كان حقل كلمة المرور فارغ أم لا (فارغ إلا إذا لم يدخل واحد)
	if (password ~= "" and password ~= nil) then
		-- محاولة إضافة الحساب، وحفظ قيمته في فار
		local accountAdded = addAccount(getPlayerName(source), password)
		if (accountAdded) then
			--  اخبار المستخدم ان كل شيء تم
			outputChatBox("Thank you "..getPlayerName(source)..", you're now registed, you can login with /login", source)
		else
			-- اخبار المستخدم انا هناك خطا عند انشاء الحساب
			outputChatBox("Error creating account, contact the server admin", source)
		end
	else
		-- هناك خطأ في تركيب الامر ,اخبار المستخدم التركيب الصحيح
		outputChatBox("Error creating account, correct syntax: /register <password>", source)
	end
end
addCommandHandler("register", registerPlayer) -- اضافة امر

هذا الرمز يختلف عن طريق السماح للمستخدم بتغيير اسم المستخدم الخاص بهم الذي كانوا يرغبون في استخدام.

مثال 2 : ا يسمح للاعبين للتسجيل في الخادم الخاص بك باستخدام /register <username> <password> في نافذة الشات.

function registerPlayer(source, commandName, username, password)
        if(password ~= "" and password ~= nil and username ~= "" and username ~= nil) then
                local accountAdded = addAccount(username,password)
                if(accountAdded) then
                        outputChatBox("Thank you "..getPlayerName(source)..", you're now registed, you can login with /login",source)
                else
                        outputChatBox("Error creating account, contact the server admin.",source)
                end
        else
                outputChatBox("Error creating account, correct syntax: /register <nick> <pass>",source)
        end
end
addCommandHandler("register", registerPlayer) -- اضافة امر

مثال 3 : هذا الرمز يختلف مرة أخرى بحيث يمكن للمستخدم تسجيل مرة واحدة فقط /register <username> <password>.

local bRegisteredOnce = false

function registerPlayer(source, commandName, username, password)
        if(password ~= "" and password ~= nil and username ~= "" and username ~= nil and bRegisteredOnce == false) then
                local accountAdded = addAccount(username,password)
                if(accountAdded) then
                        outputChatBox("Thank you " .. getPlayerName(source)..", you're now registed, you can login with /login",source)
                        bRegisteredOnce = true
                else
                        outputChatBox("Error creating account, contact the server admin.",source)
                end
        else
                if bRegisteredOnce == true then
                    outputChatBox("You already registered on this server!",source)
                else
                    outputChatBox("Error creating account, correct syntax: /register <nick> <pass>",source)
                end
        end
end
addCommandHandler("register", registerPlayer) -- اضافة امر

3B00DG4MER

انظر ايضاً