27.01.2015, 16:15
Hello!
I'm using Y_ini saving system and I'm stuck at detecting how many times player logged in the server, this is what I've made I mean It's copied from tutorial..
So what I want is, to detect number of logins on my login dialog
This code below shows number "27" all the time...
But in my saved Users folder logged in times are counting fine, but this code doesn't want to show it
Full code:
I'm using Y_ini saving system and I'm stuck at detecting how many times player logged in the server, this is what I've made I mean It's copied from tutorial..
pawn Код:
enum PlayerInfo
{
Pass[129], //ignore
Adminlevel, //ignore
VIPlevel, //ignore
Money, ///ignore
Scores, //ignore
Kills, //ignore
Deaths, //ignore
Logins // Here is the Login "detector"
}
new pInfo[MAX_PLAYERS][PlayerInfo];
This code below shows number "27" all the time...
pawn Код:
format(string, sizeof(string), "Times Logged: %d",pInfo[playerid][Logins]);
Full code:
pawn Код:
public OnPlayerConnect(playerid)
{
new hour, minute, second, string[300], year, month, day;
getdate(year, month, day);
gettime(hour, minute, second);
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
GetPlayerName(playerid,name,sizeof(name)); //Get player's name
if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
{// then
INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
format(string, sizeof(string), "Times Logged: %d",pInfo[playerid][Logins]); // THIS ISN'T WORKING =========================
ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{FF8000} Login",string,"Login","Quit");
//ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"{FF8000} Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");// 30 spaces
}
else //If the connected user is not registered,
{//then we will 'force' him to register :)
ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"{0D00FF}Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
return 1;
}
return 1;
}