Advertisement
Guest User

RegCheck (Updated)

a guest
Apr 8th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.86 KB | None | 0 0
  1. //Вставь эти проверки выше, чем энуменатор для массива игрока
  2. #if !defined MAX_PLAYER_PASSWORD
  3.     const MAX_PLAYER_PASSWORD = 31; // заменм на свое значение и в энуменаторе замени значение на эту константу.
  4. #endif
  5. #if !defined MAX_PLAYER_EMAIL
  6.     const MAX_PLAYER_EMAIL = 50; //Проделай тоже самое, что делал выше
  7. #endif
  8. #if !defined MAX_REFER_NAME
  9.     const MAX_REFER_NAME = 24; //Проделай тоже самое, что делал выше
  10. #endif
  11.  
  12.  
  13. stock CheckRegistration(playerid)
  14. {
  15.     #if !defined COLOR_WHITE
  16.         #define _C_WHITE_DEFINED
  17.         #define COLOR_WHITE "{FFFFFF}"
  18.     #endif
  19.     #if !defined COLOR_BLUE
  20.         #define _C_BLUE_DEFINED
  21.         #define COLOR_BLUE "{4582A1}"
  22.     #endif
  23.     #if !defined COLOR_RED
  24.         #define _C_RED_DEFINED
  25.         #define COLOR_RED "{AA3333}"
  26.     #endif
  27.  
  28.     new
  29.         password[MAX_PLAYER_PASSWORD],
  30.         email[MAX_PLAYER_EMAIL],
  31.         refer[MAX_REFER_NAME];
  32.  
  33.     strcat(password, PlayerRegInfo[playerid][Password], MAX_PLAYER_PASSWORD);
  34.     strcat(email, PlayerRegInfo[playerid][Email], MAX_PLAYER_PASSWORD);
  35.     strcat(refer, PlayerRegInfo[playerid][Ref], MAX_PLAYER_PASSWORD);
  36.  
  37.     new
  38.         race            = PlayerRegInfo[playerid][Rassa],
  39.         skin            = PlayerRegInfo[playerid][Skin],
  40.         gender          = PlayerRegInfo[playerid][Gender],
  41.         password_length = strlen(PlayerRegInfo[playerid][Password]),
  42.         email_length    = strlen(PlayerRegInfo[playerid][Email]),
  43.         refer_length    = strlen(PlayerRegInfo[playerid][Ref]);
  44.  
  45.     static const gender_info[][] =
  46.     {
  47.         COLOR_RED   "Не выбран",
  48.         COLOR_BLUE  "Мужской",
  49.         COLOR_BLUE  "Женский"
  50.     };
  51.  
  52.     static const race_info[][] =
  53.     {
  54.         COLOR_RED   "Не выбрана",
  55.         COLOR_BLUE  "Афроамереканец",
  56.         COLOR_BLUE  "Европеец",
  57.         COLOR_BLUE  "Азиат"
  58.     };
  59.  
  60.     static const string_content[] =
  61.         COLOR_WHITE     "Пароль: %s%s\n\
  62.        "COLOR_WHITE    "Почта: %s%s\n\
  63.        "COLOR_WHITE    "Реферал: %s%s\n\
  64.        "COLOR_WHITE    "Пол: %s\n\
  65.        "COLOR_WHITE    "Национальность: %s\n\
  66.                        %sПродолжить регистрацию\n";
  67.  
  68.     new string[sizeof(string_content)
  69.         - 4 + MAX_PLAYER_PASSWORD + 8
  70.         - 4 + MAX_PLAYER_EMAIL + 8
  71.         - 4 + MAX_REFER_NAME + 8
  72.         - 2 + 10 + 8
  73.         - 2 + 16 + 8
  74.         - 2 + 8];
  75.  
  76.     if(!(0 < gender < sizeof(gender_info)))
  77.     {
  78.         gender = 0;
  79.     }
  80.  
  81.     if(!(0 < race < sizeof(race_info)))
  82.     {
  83.         race = 0;
  84.     }
  85.  
  86.     new isok = (password_length && email_length && gender && race && skin);
  87.  
  88.     format(string, sizeof(string), string_content,
  89.         ((password_length) ? (COLOR_BLUE) : (COLOR_RED)),
  90.         ((password_length) ? (password) : ("Не задан")),
  91.         ((email_length) ? (COLOR_BLUE) : (COLOR_RED)),
  92.         ((email_length) ? (email) : ("Не задан")),
  93.         ((refer_length) ? (COLOR_BLUE) : (COLOR_RED)),
  94.         ((refer_length) ? (refer) : ("Не задан")),
  95.         gender_info[gender],
  96.         race_info[race],
  97.         ((isok) ? (COLOR_BLUE) : (COLOR_RED)));
  98.  
  99.     ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_LIST,
  100.         "{FFFFFF}Регистрация на {AA3333}"NAME_SERVER,
  101.         string,
  102.         "Далее", "Отмена");
  103.  
  104.     print(string);
  105.  
  106.     #if defined _C_WHITE_DEFINED
  107.         #undef _C_WHITE_DEFINED
  108.         #undef COLOR_WHITE
  109.     #endif
  110.     #if defined _C_BLUE_DEFINED
  111.         #undef _C_BLUE_DEFINED
  112.         #undef COLOR_BLUE
  113.     #endif
  114.     #if defined _C_RED_DEFINED
  115.         #undef _C_RED_DEFINED
  116.         #undef COLOR_RED
  117.     #endif
  118.  
  119.     return 1;
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement