21.02.2014, 21:58
Im making a score save system with Dini, when I log in and get score then log out it saves, but when I log in again it doesnt load the score... whats the code to do this, This is my OnPlayerConnect
OnPlayerDisconnect
Код:
public OnPlayerConnect(playerid) { new string[128]; new plname[MAX_PLAYER_NAME]; GetPlayerName(playerid, plname, sizeof(plname)); PlayerInfo[playerid][Level] = 0; PlayerInfo[playerid][Money] = 0; PlayerInfo[playerid][Vip] = 0; PlayerInfo[playerid][Admin] = 0; PlayerInfo[playerid][Spawn] = 0; PlayerInfo[playerid][Score] = 0; format(string, sizeof(string), "/accounts/%s.ini", plname); if(dini_Exists(string)) { gPlayerAccount[playerid] = 1; } else { gPlayerAccount[playerid] = 0; } return 1; }
Код:
public OnPlayerDisconnect(playerid, reason) { new file[128]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(file,sizeof(file),"/accounts/%s.ini",name); if(dini_Exists(file)) { dini_IntSet(file, "Password",PlayerInfo[playerid][Pass]); dini_IntSet(file, "Level",PlayerInfo[playerid][Level]); dini_IntSet(file, "Money",PlayerInfo[playerid][Money]); dini_IntSet(file, "Admin",PlayerInfo[playerid][Admin]); dini_IntSet(file, "Vip",PlayerInfo[playerid][Vip]); dini_IntSet(file, "Spawn",PlayerInfo[playerid][Spawn]); dini_IntSet(file, "Score", GetPlayerScore(playerid)); } gPlayerLogged[playerid] = 0; return 1; }