Time stamp - 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: Time stamp (
/showthread.php?tid=556910)
Time stamp -
bigboy81 - 12.01.2015
i don't understand tutorial for time stamp.
How to make if player not typed /rudnik command 2hours server give him quitjob ??
Here is the command
Код:
YCMD:rudnik(playerid, params[], help)
{
#pragma unused params
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(PlayerInfo[playerid][pJob] == 25)
{
if(UzeoOpremu[playerid] == 0) return SCM(playerid, COLOR_GREY, "Morate prvo uzeti opremu u kucici na vrhu rudnika!");
if(IsPlayerInRangeOfPoint(playerid, 350, 604.7141,867.4781,-40.2878))
{
if(NaPoslu[playerid] == 1) return SCM(playerid, COLOR_WHITE, "** Vec ste na poslu.");
SetPlayerCheckpoint(playerid, 551.3589,852.8019,-42.5268, 5.0);
CP[playerid] = 2;
NaPoslu[playerid] = 1;
SCM(playerid, COLOR_WHITE, "Idi do CheckPoint-a i pocni da kopas");
}
}
else SCM(playerid, COLOR_GRAD1, "{EA0C0C}[ERROR]{FFFFFF}Moras biti rudar da bi mogao raditi u rudniku!");
return 1;
}
Tutorial from there:
https://sampforum.blast.hk/showthread.php?tid=254915
I don't understand that tutorial clearly,because english is not my mother language.
Re: Time stamp -
Beckett - 12.01.2015
Basically when you type the function gettime(); without callbacks you will get the current unix timestamp you add 2 hours to the current time then if the player types this command again you'll have to see if it has passed 7200 MS (2 hours) yet or not.
pawn Код:
new jTime[MAX_PLAYERS]; //
CMD:examplecmd(playerid,params[])
{
new timestamp = gettime();
if(timestamp > jTime[playerid])
{
jTime[playerid] = gettime()+3600*2; // 1hour: 3600 ms
printf(" Typed /examplecmd. gettime stored in jTime ");
}
else
{
new hoursleft = (jTime[playerid]-timestamp)/3600; // 1 hour is 3600 MS as I've stated above, therefore dividing jTime[playerid]-timestamp will result into the hours left.
printf("Current time: %i | 2 Hours Added: %i | Hours left for you to type this command again %i.",timestamp,jTime[playerid],hoursleft);
}
}
Re: Time stamp -
bigboy81 - 12.01.2015
Quote:
Originally Posted by DaniceMcHarley
Basically when you type the function gettime(); without callbacks you will get the current unix timestamp you add 2 hours to the current time then if the player types this command again you'll have to see if it has passed 7200 MS (2 hours) yet or not.
pawn Код:
new jTime[MAX_PLAYERS]; // CMD:examplecmd(playerid,params[]) { new timestamp = gettime(); if(timestamp > jTime[playerid]) { jTime[playerid] = gettime()+3600*2; // 1hour: 3600 ms printf(" Typed /examplecmd. gettime stored in jTime "); } else { new hoursleft = (jTime[playerid]-timestamp)/3600; // 1 hour is 3600 MS as I've stated above, therefore dividing jTime[playerid]-timestamp will result into the hours left. printf("Current time: %i | 2 Hours Added: %i | Hours left for you to type this command again %i.",timestamp,jTime[playerid],hoursleft); } }
|
From this i can make if player not 2 Months on the server script delete him account ?
Re: Time stamp -
HazardouS - 12.01.2015
You can, just save his last login as Timestamp and make some kind of timer to check all the accounts, including offline, and delete the account if last login is older than 2 months.
Re: Time stamp -
bigboy81 - 12.01.2015
Quote:
Originally Posted by DaniceMcHarley
Basically when you type the function gettime(); without callbacks you will get the current unix timestamp you add 2 hours to the current time then if the player types this command again you'll have to see if it has passed 7200 MS (2 hours) yet or not.
pawn Код:
new jTime[MAX_PLAYERS]; // CMD:examplecmd(playerid,params[]) { new timestamp = gettime(); if(timestamp > jTime[playerid]) { jTime[playerid] = gettime()+3600*2; // 1hour: 3600 ms printf(" Typed /examplecmd. gettime stored in jTime "); } else { new hoursleft = (jTime[playerid]-timestamp)/3600; // 1 hour is 3600 MS as I've stated above, therefore dividing jTime[playerid]-timestamp will result into the hours left. printf("Current time: %i | 2 Hours Added: %i | Hours left for you to type this command again %i.",timestamp,jTime[playerid],hoursleft); } }
|
This not work good.
Re: Time stamp -
bigboy81 - 12.01.2015
FIRST BUMP !
Re: Time stamp -
bigboy81 - 13.01.2015
My gettime is stored in jTime and now i can't login to the server -.-
What to do...
Re: Time stamp -
bigboy81 - 13.01.2015
BUMP TWO !