04.06.2009, 18:37
Okay I have these commands:
My question, when player disconnect, will it save?
Код:
dcmd_register(playerid, params[]) { new file[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), "\\Users\\%s.ini", pname); if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "* Try '/register' [Password]"); if(dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "* You are already registered!"); dini_Create(file); dini_IntSet(file, "HashPW", udb_hash(params)); dini_Set(file, "Password", params); dini_IntSet(file, "Score", GetPlayerScore(playerid)); dini_IntSet(file, "Money", GetPlayerMoney(playerid)); dini_IntSet(file, "pJob", PlayerInfo[playerid][pJob]); new string[128]; format(string, 128, "* Welcome to Blueberry Role-Play! Nickname %s with password %s", pname, params); SendClientMessage(playerid, COLOR_YELLOW, string); Logged[playerid] = 1; SendClientMessage(playerid, COLOR_YELLOW, "* You have been automatically logged in!"); return 1; } dcmd_login(playerid, params[]) { new file[128]; new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), "\\Users\\%s.ini", pname); if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "* Try '/login' [Password]"); if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "* You are not registered!"); if(Logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "* You are already logged in!"); new tmp[128]; tmp = dini_Get(file, "HashPW"); if(udb_hash(params) != strval(tmp)) { format(string, 128, "You specified the wrong password for %s!", pname); SendClientMessage(playerid, COLOR_RED, string); } else { Logged[playerid] = 1; SetPlayerScore(playerid, dini_Int(file, "Score")); GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid)); PlayerInfo[playerid][pJob] = dini_Int(file, "pJob"); SendClientMessage(playerid, COLOR_YELLOW, "* You have succesfully logged in!"); } return 1; }