09.05.2014, 14:16
This is from ******. I dont want to include this to my gamemode but want to implement it
Код:
stock Extra_DoRegister(playerid, string:pw[]) { if (Player_IsLoggedIn(playerid)) { Text_Send(playerid, $YSI_LOGIN_ALREADY); return 1; } else if (Player_IsRegistered(playerid)) { //Text_Send(playerid, $YSI_LOGIN_ALREADY); Text_Send(playerid, $YSI_REG_TAKEN); Extra_DoLogin(playerid, NULL); return 1; } if (isnull(pw)) { // Enter password. inline Response1(pid1, dialogid1, response1, listitem1, string:text1[]) { #pragma unused listitem1, dialogid1, pid1 if (response1) { switch (strlen(text1)) { case 0: { Text_Send(playerid, $YSI_LOGIN_ENTER); } case 1: { if (isnull(text1)) Text_Send(playerid, $YSI_LOGIN_ENTER); else Text_Send(playerid, $YSI_LOGIN_LENGTH); } case 2 .. 5: { Text_Send(playerid, $YSI_LOGIN_LENGTH); } default: { // Can add code here to test the strength of the pass. Extra_DoRegister(playerid, text1); return 1; } } Extra_DoRegister(playerid, NULL); } } Text_PasswordBox(playerid, using inline Response1, $YSI_EXTRA_REGISTER_TITLE, $YSI_EXTRA_REGISTER_PROMPT, $DIALOG_OK, $DIALOG_CANCEL); } else { // Store the password localy in the function and get confirmation. new pass[32]; strcpy(pass, pw); inline Response2(pid2, dialogid2, response2, listitem2, string:text2[]) { #pragma unused listitem2, dialogid2, pid2 if (response2) { switch (strlen(text2)) { case 0: { Text_Send(playerid, $YSI_LOGIN_ENTER); } case 1: { if (isnull(text2)) Text_Send(playerid, $YSI_LOGIN_ENTER); else Text_Send(playerid, $YSI_LOGIN_LENGTH); } case 2 .. 5: { Text_Send(playerid, $YSI_LOGIN_LENGTH); } default: { if (strcmp(pass, text2)) { Text_Send(playerid, $YSI_EXTRA_REGISTER_MISMATCH); } else { Player_TryRegister(playerid, text2); return 1; } } } // Try again. Extra_DoRegister(playerid, pass); } } Text_PasswordBox(playerid, using inline Response2, $YSI_EXTRA_REGISTER_TITLE, $YSI_EXTRA_CONFIRM_PROMPT, $DIALOG_OK, $DIALOG_CANCEL); } return 1; } YCMD:register(playerid, params[], help) { if (help) { Text_Send(playerid, $YSI_REGISTER_HELP); } else { Extra_DoRegister(playerid, params); } return 1; }