SA-MP Forums Archive
help | Once every day - 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: help | Once every day (/showthread.php?tid=555627)



help | Once every day - _Application_ - 08.01.2015

How do I can do a specific command, once every day?
(Every time at 12 at night can again




Re: help | Once every day - _Application_ - 08.01.2015

... help ?


Re: help | Once every day - HeLiOn_PrImE - 08.01.2015

You can try to store the current date and check it when the command is sent. if the date is the same as before, decline the command.


Re: help | Once every day - Jefff - 08.01.2015

On top
pawn Код:
new CurDay;
OnGameModeInit
pawn Код:
new Year, Month;
getdate(Year, Month, CurDay);
and

pawn Код:
bool:IsCmdLocked()
{
    new Year, Month, Day;
    getdate(Year, Month, Day);
    if(Day == CurDay) return true;
    CurDay = Day;
    return false;
}
pawn Код:
if(IsCmdLocked()) return SendClientMessage(playerid,-1,"Command is blocked");



Re: help | Once every day - _Application_ - 09.01.2015

Quote:
Originally Posted by Jefff
Посмотреть сообщение
On top
pawn Код:
new CurDay;
OnGameModeInit
pawn Код:
new Year, Month;
getdate(Year, Month, CurDay);
and

pawn Код:
bool:IsCmdLocked()
{
    new Year, Month, Day;
    getdate(Year, Month, Day);
    if(Day == CurDay) return true;
    CurDay = Day;
    return false;
}
pawn Код:
if(IsCmdLocked()) return SendClientMessage(playerid,-1,"Command is blocked");
Now I will run the command once I will have to wait to 12 at night right?


Re: help | Once every day - _Application_ - 09.01.2015

??


Re: help | Once every day - bgedition - 09.01.2015

You may use gettime.


Re: help | Once every day - bgedition - 09.01.2015

If you use ZCMD:
pawn Код:
CMD:commandname(playerid, params[]) {
    new hour, minute, second;
    gettime(hour, minute, second);
    if(hour == 0) {
        //command code
    } else {
        return SendClientMessage(playerid, /*your color*/, "[ERROR]: You can use this command only at 12 AM.");
    }
    return 1;
}



Re: help | Once every day - bgedition - 09.01.2015

It works ?


Re: help | Once every day - _Application_ - 09.01.2015

Quote:
Originally Posted by bgedition
Посмотреть сообщение
It works ?
Listen,
i created a mission,

Now I want to do it would be possible to do the job, once per day, and at midnight the variables will be reset, and it will be possible to redo the assignment.

Understand?