Gettime - 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: Gettime (
/showthread.php?tid=624677)
Gettime -
SpaceRP - 20.12.2016
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
Re: Gettime -
JaKe Elite - 20.12.2016
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?
Re: Gettime -
SpaceRP - 20.12.2016
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]);
Re: Gettime -
JaKe Elite - 20.12.2016
Quote:
Originally Posted by SpaceRP
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)
Re: Gettime -
SpaceRP - 20.12.2016
I tried but it does not work, do not invite the saveacc as if crash to y_ini
Re: Gettime -
JaKe Elite - 20.12.2016
Quote:
Originally Posted by SpaceRP
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?
Re: Gettime -
SpaceRP - 20.12.2016
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;
}
Re: Gettime -
Konstantinos - 20.12.2016
Update to
YSI 4. Native
valstr crashes the server for high values.
Re: Gettime -
SpaceRP - 20.12.2016
I put all this now and again does not save GetTime
Re: Gettime -
Hayden_Almeida - 21.12.2016
Quote:
Originally Posted by SpaceRP
I put all this now and again does not save GetTime
|
Do you want to save TIMESTAMP, right?