17.03.2012, 15:15
Код:
new query[400]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(query, sizeof(query), "SELECT * FROM `players` WHERE name = '%s' LIMIT 1", name); mysql_query(query); mysql_store_result(); new rows = mysql_num_rows(); if(!rows) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COL_WHITE"Registration",""COL_WHITE"Enter password to register in our server.","Next","Quit"); if(rows == 1) { ResetPlayerCash(playerid); new string[1024]; if(mysql_fetch_row_format(string,"|")) { mysql_fetch_field_row(PlayerInfo[playerid][pPass], "pass"); mysql_fetch_field_row(string, "uzbanintas"); PlayerInfo[playerid][pUzbanintas] = strval(string); mysql_fetch_field_row(PlayerInfo[playerid][pPriezastis], "priezastis"); mysql_fetch_field_row(PlayerInfo[playerid][pKasBan], "kas_ban"); mysql_fetch_field_row(string, "ban_laikas"); PlayerInfo[playerid][pBanLaikas] = strval(string); mysql_fetch_field_row(PlayerInfo[playerid][pSlaptKlaus], "slapt_klaus"); mysql_fetch_field_row(PlayerInfo[playerid][pSlaptAts], "slapt_ats"); mysql_fetch_field_row(string, "pinigai"); PlayerInfo[playerid][pPinigai] = strval(string); mysql_fetch_field_row(string, "ar_adminas"); PlayerInfo[playerid][pAdminas] = strval(string); mysql_fetch_field_row(string, "ar_vip"); PlayerInfo[playerid][pVipas] = strval(string); mysql_fetch_field_row(string, "pos_x"); PlayerInfo[playerid][pPosX] = floatstr(string); mysql_fetch_field_row(string, "pos_y"); PlayerInfo[playerid][pPosY] = floatstr(string); mysql_fetch_field_row(string, "pos_z"); PlayerInfo[playerid][pPosZ] = floatstr(string); mysql_fetch_field_row(string, "active_class"); PlayerInfo[playerid][pActiveClass] = strval(string); mysql_fetch_field_row(string, "team"); PlayerInfo[playerid][pTeam] = strval(string); if (PlayerInfo[playerid][pUzbanintas] > 0) { new textas[225]; new textas1[225]; format(textas, sizeof(textas), "Jus uюblokavo: {FFFFFF}%s", PlayerInfo[playerid][pKasBan]); format(textas1, sizeof(textas1), "Prieюastis: {FFFFFF}%s", PlayerInfo[playerid][pPriezastis]); SendClientMessage(playerid, COL_SYSTEM, "Jыs esate uюblokuotas!"); SendClientMessage(playerid, COL_SYSTEM, textas); SendClientMessage(playerid, COL_SYSTEM, textas1); SendClientMessage(playerid, COL_SYSTEM, "Atblokuoti savo vartotojo vardа galite mыsш tinklapyje."); Kick(playerid); } new nm[225]; format(nm,sizeof(nm),""COL_WHITE"Welcome back, "COL_GREEN"%s.\n{65CFBD}Please enter your password:",name); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Login", nm, "Enter", "Quit"); } } mysql_free_result(); return 1; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_RED"You entered an incorrect password.\n"COL_WHITE"In order to be registered in our server, please enter an password for your account.","Next","Quit"); new inputt[225]; format(inputt,sizeof(inputt), inputtext); passwd[playerid] = inputt; ShowPlayerDialog(playerid, DIALOG_REGISTER_2, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_WHITE"Please repeat your password","Next","Quit"); } } case DIALOG_REGISTER_2: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER_2, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_RED"You entered an incorrect password.\n"COL_WHITE"Please repeat your password","Next","Quit"); if(strcmp(passwd[playerid], inputtext, false, strlen(passwd[playerid])) == 1) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"Registration",""COL_RED"Password does not match the first password.\n"COL_WHITE"In order to be registered in our server, please enter an password for your account.","Next","Quit"); ShowPlayerDialog(playerid, DIALOG_REGISTER_3, DIALOG_STYLE_INPUT, ""COL_WHITE"Registration",""COL_GREEN"Password successfuly accepted by the server.\n"COL_WHITE"Please enter secret question for your account. (For security purposes)","Next","Quit"); } }