Week, Month Stats saving problem
#1

Hello,

I am currently working on a gamemode.But i am stucked at something i have no idea how to save week stats, month stats.Like a player registers and when he is a week old the current score gets saved in week and then it gets reset and when again one week completes it will get addup with the current same with months.I've maded register/login system and it saves RegisterDate is it possible anyway to check dates and get to know thats he was registered 7 days ago bla bla.So we can store week stats of the player.I am using MySQL R6.A example code will be good.
Reply
#2

BUMP
Reply
#3

Why would you want to save week stats? What do you mean by week stats at all?

If you want to check how long it has been you could use the getdate and gettime function. It's simple math.

https://sampwiki.blast.hk/wiki/Getdate

https://sampwiki.blast.hk/wiki/Gettime
Reply
#4

How can i compare date?

By week stats i mean that the player score player earned in the week.
Reply
#5

If you saved the date the player registered, you just simply subtract the date.
Reply
#6

Make a new variable LastWeek.
When the player is login in:
pawn Код:
new day,month,year;
getdate(day,month,year);
if(day - LastWeek[playerid] >= 7)
{
 //..Reset stats
 LastWeek[playerid] = day;
}
Something like that.
Reply
#7

I dont think it will work that way.Also i am storing Registration Date in string in MySQL.So NO subtracting can be done.I guess it can be done with Timestamp ( i read tutorial on it and still not understood it properly).A easy example would be better (using timestamp).
Reply
#8

Why don't you just fetch the date from MySQL and subtract it like I said?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)