stock SavePlayer(playerid) { new query[1024], aName[MAX_PLAYER_NAME]; GetPlayerName(playerid, aName, sizeof(aName)); mysql_format(mysql, query, sizeof(query), "UPDATE accounts SET AdminLevel = '%d', Age = '%d', Gender = '%d', Skin = '%d', Money = '%d', Level = '%d', Job = '%d', Materials = '%d', Drugs ='%d' WHERE ID = '%d'", pInfo[playerid][pAdminLevel], pInfo[playerid][pAge], pInfo[playerid][pGender], GetPlayerSkin(playerid), GetPlayerMoney(playerid), GetPlayerScore(playerid), pInfo[playerid][pJob], pInfo[playerid][pMaterials], pInfo[playerid][pDrugs], pInfo[playerid][pID]); mysql_tquery(mysql, query); printf("Player ID %d (%s) has been saved", playerid, GetName(playerid)); }
public OnAccountLoad(playerid) { pInfo[playerid][pAdminLevel] = cache_get_field_content_int(0, "AdminLevel"); pInfo[playerid][pSkin] = cache_get_field_content_int(0, "Skin"); pInfo[playerid][pAge] = cache_get_field_content_int(0, "Age"); pInfo[playerid][pGender] = cache_get_field_content_int(0, "Gender"); pInfo[playerid][pMoney] = cache_get_field_content_int(0, "Money"); pInfo[playerid][pLevel] = cache_get_field_content_int(0, "Level"); pInfo[playerid][pJob] = cache_get_field_content_int(0, "Job"); pInfo[playerid][pMaterials] = cache_get_field_content_int(0, "Materials"); pInfo[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs"); cache_get_field_content(playerid,"Email",pInfo[playerid][pEmail],mysql,256); SetPlayerColor(playerid, COLOR_WHITE); GivePlayerMoney(playerid, pInfo[playerid][pMoney]); SetPlayerScore(playerid, pInfo[playerid][pLevel]); SetPlayerSkin(playerid, pInfo[playerid][pSkin]); SetSpawnInfo(playerid, 0, pInfo[playerid][pSkin], 1799.9459, -1867.2007, 13.5705, 2.0529, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); if(pInfo[playerid][pAdminLevel] > 0) { new string[256], string2[256], aName[MAX_PLAYER_NAME]; format(string, sizeof(string), "You have logged in as a level %d admin.", pInfo[playerid][pAdminLevel]); SendClientMessage(playerid, -1, string); GetPlayerName(playerid, aName, sizeof(aName)); format(string2, sizeof(string2), "(+) Admin %s has just logged in!", aName); AdminChat(string2, COLOR_ADMIN); } SendClientMessage(playerid, -1, "Successfully logged in"); return 1; }
case DIALOG_LOGIN: { if(!response) Kick(playerid); new hpass[129]; new query[100]; WP_Hash(hpass, 129, inputtext); if(!strcmp(hpass, pInfo[playerid][pPassword])) { mysql_format(mysql, query, sizeof(query), "SELECT * FROM `accounts` WHERE `Username` = '%s'", GetName(playerid)); mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "MaxZone: Login", "Welcome\n\nPlease enter your password.", "Login", "Quit"); SendClientMessage(playerid, -1, "You have entered the wrong password."); } }
[00:06:52] [DEBUG] Calling callback "OnAccountLoad".. [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "AdminLevel", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "AdminLevel", data: "2" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Skin", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Skin", data: "60" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Age", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Age", data: "16" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Gender", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Gender", data: "1" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Money", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Money", data: "75000" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Level", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Level", data: "1" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Job", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Job", data: "0" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Materials", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Materials", data: "0" [00:06:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "Drugs", connection: 1 [00:06:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Drugs", data: "0"
pInfo[playerid][pAdminLevel] = cache_get_field_content_int(0, "AdminLevel");
pInfo[playerid][pSkin] = cache_get_field_content_int(0, "Skin");
pInfo[playerid][pAge] = cache_get_field_content_int(0, "Age");
pInfo[playerid][pGender] = cache_get_field_content_int(0, "Gender");
pInfo[playerid][pMoney] = cache_get_field_content_int(0, "Money");
pInfo[playerid][pLevel] = cache_get_field_content_int(0, "Level");
pInfo[playerid][pJob] = cache_get_field_content_int(0, "Job");
pInfo[playerid][pMaterials] = cache_get_field_content_int(0, "Materials");
pInfo[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs");
cache_get_field_content(playerid,"Email",pInfo[playerid][pEmail],mysql,256);
new tmp[32];
cache_get_field_content(0, "row_name_db", tmp, mysql_handle), enum_array = strval(tmp);
pawn Код:
pawn Код:
|