How To Check If The Owner Hasn't Entered His House In 2 Weeks
#1

i got the last visit date stored in this var
pawn Код:
HouseInfo[id][hLastVisitD]
Reply
#2

set a timer i suppose but it will lag i thing if you set for each house for 2 weeks :\
Reply
#3

what? explain more..
Reply
#4

i think i found exactly what you need https://sampwiki.blast.hk/wiki/Getdate
Reply
#5

no...... there would be problems.. what if the last visit date is 31 i dont know how to check for 2 weeks.. your not helping
Reply
#6

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
no...... there would be problems.. what if the last visit date is 31 i dont know how to check for 2 weeks.. your not helping
He is helping, don't just expect him to just hand you a code.
Reply
#7

Use gettime() without any variables to retrieve a unix timestamp, store the returned value from gettime() in your HouseInfo[id][hLastVisitD] variable and perform a loop of all houses every 2 weeks, or every time your server starts and see whether the last visit date was over 1209600 seconds ago (basically, unix timestamps return the time since Jan 1 1970, perform a check to see whether the last visit date was 2 weeks ago).

I apologize if I failed to explain this properly.
Reply
#8

thank you.
im doing this
pawn Код:
if(HouseInfo[id][hLastVisitD] != 0)
                {
                if(HouseInfo[id][hLastVisitD] + (86000 * 2) <= gettime())
                {
                    printf("Last Visit Date Test");
                }
                }
but it seems to always print the example? someone told me that 86000 seconds is one week so 86000 * 2 i guess?
Reply
#9

604,800 seconds are in a week. 86,400 are in a day.
Reply
#10

so i should be doing this? it still prints if i entered today.
pawn Код:
#define WEEK ( 86000 * 7 )             
if(HouseInfo[id][hLastVisitD] != 0)
                {
                if(HouseInfo[id][hLastVisitD] + (WEEK * 2) <= gettime())
                {
                    printf("Last Visit Date Test");
                }
                }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)