Detecting logins? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Detecting logins? (
/showthread.php?tid=560223)
Detecting logins? -
Razturach - 27.01.2015
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..
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];
So what I want is, to detect number of logins on my login dialog
This code below shows number "27" all the time...
pawn Код:
format(string, sizeof(string), "Times Logged: %d",pInfo[playerid][Logins]);
But in my saved Users folder logged in times are counting fine, but this code doesn't want to show it
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;
}
Re: Detecting logins? -
nezo2001 - 27.01.2015
Add Under OnDialogResponse under the register and under the login dialogs
PHP код:
pInfo[playerid][Logins]++;
Re: Detecting logins? -
Razturach - 27.01.2015
I have that, it still shows same number 27 it doesn't count right.. In player's database every login is counted right but here on Dialog it's always same number..27, so how detect how much logins players already done and format logins to the dialog?
Re: Detecting logins? -
Razturach - 27.01.2015
Fixed

Thanks for help also