AR/setAccountPassword: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server function}} هذه الوظيفة لتغير كلمة المرور لحساب معين ==Syntax== <syntaxhighlight lang="lua"> bool setAccountPassword ( account theAccount, ...")
 
m (Добавление языков)
 
(2 intermediate revisions by one other user not shown)
Line 8: Line 8:
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===العناصر المطلوبة===  
*'''theAccount:''' الحساب الذي تريد تغيير كلمة المرور له
*'''theAccount:''' الحساب الذي تريد تغيير كلمة المرور له
*'''password:''' كلمة المرور
*'''password:''' كلمة المرور
Line 48: Line 48:
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==انظر ايضاً==
{{AR Account functions}}
{{AR Account functions}}


[[en:setAccountPassword]]
[[en:setAccountPassword]]
[[ru:setAccountPassword]]
[[ar:setAccountPassword]]
[[es:setAccountPassword]]
[[es:setAccountPassword]]
[[zh-cn:setAccountPassword]]

Latest revision as of 15:49, 12 April 2021

هذه الوظيفة لتغير كلمة المرور لحساب معين

Syntax

bool setAccountPassword ( account theAccount, string password )

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

  • theAccount: الحساب الذي تريد تغيير كلمة المرور له
  • password: كلمة المرور

Returns

Returns true if the password was set correctly, false otherwise.

Example

/changepass هذا المثال يسمح للمستخدم تغيير كلمة المرور عن طريق الأمر

function ChangePlayerPassword(player,command,oldpass,newpass)
	-- get the account the player is currently logged into
	local account = getPlayerAccount(player)
	if (account) then
		-- if its only a guest account, do not allow the password to be changed
		if (isGuestAccount(account)) then
			outputChatBox("You must be logged into an account to change your password.",player) 
			-- end the function
			return
		end
		
		-- check that the old password is correct
		local password_check = getAccount(getPlayerUserName(player),oldpass)
		if (oldpass==password_check) then
			-- check the length of the new password
			if (string.len(newpass)>=5) then
				setAccountPassword(account,newpass)
			else
				outputChatBox("Your new password must be at least 5 characters long.",player)
			end
		else
			outputChatBox("Old password invalid.",player)
		end
	end

addCommandHandler("changepass",ChangePlayerPassword)

انظر ايضاً