25.01.2017, 02:31
How can i make this code like this? IF the field is 0, then continue, else the login is blocked.
Код:
forward OnAccountCheck(playerid); public OnAccountCheck(playerid) { new rows, fields, string[128]; cache_get_row_count(rows); cache_get_field_count(fields); if (rows) { if (cache_get_value_name_int(0, "Locked", Account[playerid][Locked])) { ShowPlayerDialog(playerid, DIALOG_LOCKED, DIALOG_STYLE_MSGBOX, ""COLOR_ORANGE"System", ""COLOR_WHITE"This account is locked due to too many failed attempts upon login.\nPlease contact a administrator to unlock this account.\n\nClick '"COLOR_LIGHTRED"Accept"COLOR_WHITE"' to close.", ""COLOR_ORANGE"Accept", ""); return true; } else if (cache_get_value_name_int(0, "isLogged", Account[playerid][isLogged])) { ShowPlayerDialog(playerid, DIALOG_ISLOGGED, DIALOG_STYLE_MSGBOX, ""COLOR_ORANGE"System", ""COLOR_WHITE"This account is currently online.", ""COLOR_ORANGE"Close", ""); return true; } else { cache_get_value_name(0, "Password", Account[playerid][Password], 129); cache_get_value_name_int(0, "ID", Account[playerid][ID]); format(string, sizeof(string), ""COLOR_WHITE"This account is registered. Please input your password below\n\nUsername: "COLOR_YELLOW"%s\n\n"COLOR_WHITE"Password:", GetName(playerid)); return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, ""COLOR_ORANGE"Login", string, ""COLOR_ORANGE"Login", ""COLOR_WHITE"Quit"); } } else { format(string, sizeof(string), ""COLOR_WHITE"This account is NOT registered. Please input your password below\n\nUsername: "COLOR_YELLOW"%s\n\n"COLOR_WHITE"Password:", GetName(playerid)); return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COLOR_ORANGE"Register", string, ""COLOR_ORANGE"Register", ""COLOR_WHITE"Quit"); } }