Advertisement
Guest User

account script

a guest
Nov 17th, 2023
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <script src="https://download.playfab.com/PlayFabClientApi.js"></script>
  2.  
  3. <script>
  4. // PlayFab einrichten
  5. PlayFab.settings.titleId = ":)";
  6.  
  7. window.onload = function() {
  8. var playFabId = getCookie('PlayFabId');
  9.  
  10. function getCookie(name) {
  11. var nameEQ = name + "=";
  12. var ca = document.cookie.split(';');
  13. for(var i=0;i < ca.length;i++) {
  14. var c = ca[i];
  15. while (c.charAt(0)==' ') c = c.substring(1,c.length);
  16. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  17. }
  18. return null;
  19. }
  20.  
  21. console.log('PlayFabId aus Cookies:', playFabId); // Log der PlayFabId
  22.  
  23.  
  24. if (playFabId) {
  25. // Rufen Sie die Kontoinformationen ab und aktualisieren Sie die Seite
  26. var getAccountInfoRequest = {
  27. PlayFabId: playFabId,
  28. };
  29.  
  30. console.log('PlayFabId, die an GetAccountInfo übergeben wird: ', playFabId);
  31. try {
  32. PlayFabClientSDK.GetAccountInfo(getAccountInfoRequest, function (accountInfoResult, accountInfoError) {
  33. if (accountInfoResult) {
  34. var username = accountInfoResult.data.AccountInfo.Username;
  35. var email = accountInfoResult.data.AccountInfo.PrivateInfo.Email;
  36. // Zeigen Sie die Benutzerinformationen an
  37. document.getElementById('displayName').textContent = username;
  38. document.getElementById('email').textContent = email;
  39. console.log('Username:' + username);
  40. console.log('Email:' + email);
  41. } else if (accountInfoError) {
  42. console.log('Fehler beim Abrufen der Benutzerdaten: ' + accountInfoError.errorMessage);
  43. }
  44. });
  45. } catch (error) {
  46. console.error('Ein Fehler ist aufgetreten:', error);
  47. }
  48.  
  49. } else {
  50. console.log('PlayFabId konnte nicht aus den Cookies abgerufen werden.');
  51. }
  52. };
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement