help | Once every day
#1

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

Reply
#2

... help ?
Reply
#3

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.
Reply
#4

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");
Reply
#5

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?
Reply
#6

??
Reply
#7

You may use gettime.
Reply
#8

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;
}
Reply
#9

It works ?
Reply
#10

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)