reset house after 1 week - 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)
+--- Thread: reset house after 1 week (
/showthread.php?tid=582317)
reset house after 1 week -
sirvanec - 19.07.2015
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
Re: reset house after 1 week -
Dokins - 19.07.2015
Make use of Timestamps.
Re: reset house after 1 week -
sirvanec - 19.07.2015
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..
Re: reset house after 1 week -
Dokins - 19.07.2015
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.
Re: reset house after 1 week -
sirvanec - 19.07.2015
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
Re: reset house after 1 week -
Dokins - 19.07.2015
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.
Re: reset house after 1 week -
sirvanec - 19.07.2015
But how can i do that.. ? :/
Re: reset house after 1 week -
sirvanec - 19.07.2015
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..