Run function in Hours - 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: Run function in Hours (
/showthread.php?tid=644321)
Run function in Hours -
Leonaardo - 05.11.2017
Next, my home system has a function that charges the taxes, and if it does not pay the property will be automatically released for lack of tax.
And I wanted to put this function to run every day at 3:00 AM. This count on the Online or Offline player.
Any tips on how to do this?
pawn Код:
if(PlayerInfo[playerid][pThousa] >=1){
Lbhouse(playerid);
format(string, sizeof(string), " | HOUSES| Your home has +1 account, pay otherwise it will be released!");
SendClientMessage(playerid, 0xCAFF95AA, string);
}
Re: Run function in Hours -
Leonaardo - 06.11.2017
help ! '-'
Re: Run function in Hours -
Sgt.TheDarkness - 06.11.2017
Use gettickcount, store and have it run every 24 hours, that should solve your problem. You'll have to put the function under a timer however.
Or you could make a timer to execute every 24 hours to execute that code for online players, as far as offline goes, you might want to avoid that, since an offline player can't really pay their taxes if they aren't online.
Re: Run function in Hours -
Leonaardo - 06.11.2017
Quote:
Originally Posted by Sgt.TheDarkness
Use gettickcount, store and have it run every 24 hours, that should solve your problem. You'll have to put the function under a timer however.
Or you could make a timer to execute every 24 hours to execute that code for online players, as far as offline goes, you might want to avoid that, since an offline player can't really pay their taxes if they aren't online.
|
I understand, I managed to make the function work only for those who are online, but it did not work for those who just bought the house and left the server. So I needed to make one that counts the taxes at such a time, so Online / Offline players will also receive the tax, and if they accumulate 10 tax, the property automatically releases.
I was only able to do the tax count for anyone who is online.