SA-MP Forums Archive
How To Check If The Owner Hasn't Entered His House In 2 Weeks - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How To Check If The Owner Hasn't Entered His House In 2 Weeks (/showthread.php?tid=196849)



How To Check If The Owner Hasn't Entered His House In 2 Weeks - The_Gangstas - 07.12.2010

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



Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - XePloiT - 07.12.2010

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


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - The_Gangstas - 07.12.2010

what? explain more..


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - XePloiT - 07.12.2010

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


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - The_Gangstas - 07.12.2010

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


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - Haydz - 07.12.2010

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.


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - __ - 07.12.2010

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.


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - The_Gangstas - 07.12.2010

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?


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - bigcomfycouch - 07.12.2010

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


Re: How To Check If The Owner Hasn't Entered His House In 2 Weeks - The_Gangstas - 07.12.2010

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");
                }
                }