Count the days?
#5

here is an example
pawn Код:
LastLogin[MAX_PLAYERS];//on top

forward CheckLastLogin();//on top


OnPlayerDisconnect(playerid)
{
LastLogin[playerid] = gettime();

//now save variable LastLogin[playerid] into database
return 1;
}

OnGameModeInit()
{
SetTimer("CheckLastLogin",1000*60*5/*5 mins*/, true);//the timer
return 1;
}

public CheckLastLogin()
{
new var;//to store player's last login inside the loop

new store;//for calculation inside the loop

new c_time = gettime();// this is necessary now

//now here gt num of rows in players database
//run a loop line for(new i=0; i<=num_of_rows ; i++)
//now inside the loop load the LastLogin inside "var" variable

store= c_time - var;//insideloop
if(store >=(60*60*24*7)/*1 week*/)//inside loop
{
//the code to sell his stuff here
}


return 1;
}
you could learn about unix timestamps here https://sampforum.blast.hk/showthread.php?tid=254915

this way may caz lag

there is one more way of doing it and that is to just do the similar thing in a php file which can be called with a timer inside game or outside game which would not caz possible lags
Reply


Messages In This Thread
Count the days? - by Don_Cage - 05.07.2014, 02:32
Re: Count the days? - by Jack_Leslie - 05.07.2014, 03:16
Re: Count the days? - by Don_Cage - 05.07.2014, 03:51
Re: Count the days? - by Jack_Leslie - 05.07.2014, 03:55
Re: Count the days? - by BroZeus - 05.07.2014, 04:55
Re: Count the days? - by Don_Cage - 06.07.2014, 02:01
Re: Count the days? - by BroZeus - 06.07.2014, 04:59
Re: Count the days? - by Don_Cage - 06.07.2014, 17:23
Re: Count the days? - by Don_Cage - 06.07.2014, 22:50
Re: Count the days? - by Don_Cage - 08.07.2014, 02:47

Forum Jump:


Users browsing this thread: 3 Guest(s)