Gettime
#1

Hey guys

How to save gettime() in the format Y_ini?

INI_WriteInt - does not work

Code:
new time = gettime() + (month*2592000);

PlayerInfo[giveplayerid][pATime] = time;

...

INI_WriteInt(File, "ATime", PlayerInfo[playerid][pATime]);


Does not work
Reply
#2

It should work since gettime() returns the Unix Timestamp which is an integer, Unless you are saving it wrong.

Try this perhaps?

PHP Code:
INI_WriteInt(File"ATime"PlayerInfo[giveplayerid][pATime]); 
You are saving it to playerid not to giveplayerid?
Reply
#3

This is in command

Code:
new time = gettime() + (month*2592000);

PlayerInfo[giveplayerid][pATime] = time;
and this under public SaveAcc(playerid)

Code:
INI_WriteInt(File, "ATime", PlayerInfo[playerid][pATime]);
Reply
#4

Quote:
Originally Posted by SpaceRP
View Post
This is in command

Code:
new time = gettime() + (month*2592000);

PlayerInfo[giveplayerid][pATime] = time;
and this under public SaveAcc(playerid)

Code:
INI_WriteInt(File, "ATime", PlayerInfo[playerid][pATime]);
Maybe SaveAcc isn't being called? Try saving the player's account after using that command perhaps like for example

PHP Code:
new time gettime() + (month*2592000);
// Your codes here
PlayerInfo[giveplayerid][pATime] = time;
SaveAcc(giveplayerid); 
Try debugging SaveAcc and see if it really works (Printing out, etc)
Reply
#5

I tried but it does not work, do not invite the saveacc as if crash to y_ini
Reply
#6

Quote:
Originally Posted by SpaceRP
View Post
I tried but it does not work, do not invite the saveacc as if crash to y_ini
Well that explains it, If you places SaveAcc on the command and it crashes then that means SaveAcc isn't working? Can you show us how you scripted SaveAcc?
Reply
#7

Code:
public SaveAcc(playerid)
{
	if(Logged[playerid] == 1)
	{
    	      new INI:File = INI_Open(UserPath(playerid));
              INI_WriteInt(File,"ATime",PlayerInfo[playerid][pATime]);
        
              ...
        
             INI_Close(File);
       }
       return 1;
}
Reply
#8

Update to YSI 4. Native valstr crashes the server for high values.
Reply
#9

I put all this now and again does not save GetTime
Reply
#10

Quote:
Originally Posted by SpaceRP
View Post
I put all this now and again does not save GetTime
Do you want to save TIMESTAMP, right?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)