reset house after 1 week
#1

hi guys,

i use this house system and i need to create code that sell house after one week if player don't visit his house.. so let me know how can i do it? Thank you in advance.. +rep..

https://sampforum.blast.hk/showthread.php?tid=283501
Reply
#2

Make use of Timestamps.
Reply
#3

i started like this..

Quote:

forward ResetAndSaveHouses();
public ResetAndSaveHouses()
{
new HouseID;
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
if(AHouseData[HouseID][LastEntered] > 0 && gettime()-AHouseData[HouseID][LastEntered] > 604800) return dcmd_evelkoy;
}

return 1;
}

but it gives this problem:
Quote:

error 076: syntax error in the expression, or invalid function call

line:
Quote:

if(AHouseData[HouseID][LastEntered] > 0 && gettime()-AHouseData[HouseID][LastEntered] > 604800) return dcmd_evelkoy;

dcmd_evelkoy is like admins sell house..
Reply
#4

You can't do it like that, a command requires syntax and input, you have to manually set the house for sale and remove the old owner etc.
Reply
#5

isn't it possible to make that it makes automatic.. in this house system is it possible.. i'm trying to convert that to this house system..
https://sampforum.blast.hk/showthread.php?tid=568319
Reply
#6

Of course, it would have to be run on a timer though.

Or you could check every time the server restarts. The best option would be to check every hour, that's how I would do it.
Reply
#7

But how can i do that.. ? :/
Reply
#8

Look:

this is how i did now:

Added this under createhouse command, entering dialog
Quote:

AHouseData[HouseID][LastEntered] = 0;

And under entering i add this too
Quote:

AHouseData[HouseID][LastEntered] = gettime();

and then i add that code i posted on the top..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)