04.08.2013, 20:17
Hey,
I've created a MySQL dialog login system and it works fine... Until it attempts to load the players data when logging in. It just keeps everything set to 0.
enum:
loginplayer stock:
I've created a MySQL dialog login system and it works fine... Until it attempts to load the players data when logging in. It just keeps everything set to 0.
enum:
Код:
enum pData { username[MAX_PLAYER_NAME], password[32], score, money, admin, logged, } new playerdata[MAX_PLAYERS][pData];
Код:
stock LoginPlayer(playerid, pass[]) { new query[1000]; format(query, sizeof(query),"SELECT * FROM playerdata WHERE username = '%s' AND password = md5('%s')",playerdata[playerid][username],pass); mysql_query(query); mysql_store_result(); if(mysql_num_rows() != 0) { if(mysql_fetch_row(query, "|")) { sscanf(query,"e<p<|>s[180]s[180]iii>", playerdata[playerid]); new str[80]; format(str, sizeof(str),"Welcome %s, you have been logged in to your account",playerdata[playerid][username]); SendClientMessage(playerid, COLOR_BLUE, str); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); SetPlayerScore(playerid, playerdata[playerid][score]); GivePlayerMoney(playerid, playerdata[playerid][money]); SpawnPlayer(playerid); playerdata[playerid][logged] = 1; } } else { ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_PASSWORD,"Login to Account.","Wrong password:","Login","Cancel"); } }