[Y_INI] gettime() issue
#1

Obviously, in the English forums y_ini is more commonly used than in the German one, so I'll try here.

The following code is under my public OnPlayerConnect.

PHP код:
if(fexist(Path(playerid)) //Ьberprьfen, ob der Account existiert
{
    if(
gettime() <= INI_Int("LastDisconnect", pInfo[playerid][LastDisconnect]) + (15*60)) //Have 15min passed since the last disconnect
    
{
        new 
PlayerIP[16];
        
GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
        if(!
strcmp(PlayerIP, pInfo[playerid][IP]) //Compare IPs
        
{
            
INI_ParseFile(Path(playerid), "LoadAccount_%s", .bExtra = true, .extra = playerid); //Load Userfile
            
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Willkommen zurueck! Dieser Account ist registriert!\nBitte gib das Passwort fuer diesen Account ein!", "Einloggen", "Abbrechen"); //Login-Dialog zeigen
    
}
    }
    else
    {
    
INI_ParseFile(Path(playerid), "LoadAccount_%s", .bExtra = true, .extra = playerid); //Load Userfile
    
SpawnPlayer(playerid); //Spieler spawnen
    
}
}
else 
//Wenn der Account nicht existiert
{
    
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registrieren", "Willkommen auf San Andreas Arena! Dieser Account ist noch nicht registriert!\nBitte gib ein Passwort ein, um dich zu registrieren!\nDas Passwort muss mindestens 5 Zeichen lang sein!", "Registrieren", "Verlassen"); //Register-Dialog
    
return 1;
}
return 
1; 
Basically, what I'm trying to do, is following:
- Player disconnects from the server
- If the player connects within 15min from the last disconnect, he gets automatically logged in
- If more than 15min pass, than the Login-Dialog will be shown as usual

So much for my intetions. Now, I'm having trouble comparing "gettime()" and the time that has passed from the last disconnect.

I hope you guys can help me!

Thank you in advance!
Reply


Forum Jump:


Users browsing this thread: