Making cmd works every day
#1

..................
Reply
#2

You need to give us more information then that, what do you want this command to achieve? The best way, in my opinion would be to use a timer, which I already use to update the hours. Then just add a variable to it let's name that "World24" so after updating every hour, I'd have the command like:

pawn Код:
CMD:world(playerid, params[])
{
if(World24 == 24) // If the World24 = 24 Full day.
{
//code
World24 = 0;
}
return 1;
}
Not a full command, just an example.
Reply
#3

.........................
Reply
#4

Код:
CMD:heal(playerid, params[])
{
if(World24 == 24) // If the World24 = 24 Full day.
{
SetPlayerHealth(playerid, 100);
World24 = 0;
}
return 1;
}
Reply
#5

..................
Reply
#6

You mean ingame day or real-life day? For a real-life day, you can save the day-number (getdate) into a variable and check if the day-number is the same.

Something like this:
Код:
new lastday = // retrieve the last day from the account information here
new currentday = getdate();
if (lastday == currentday) 
{
	return SendClientMessage(playerid, -1, "You can use this command only once a day!");
}
else
{
	lastday = currentday;
	// Don't forget to save the lastday variable in the account files.
	// Do your command stuff here..
	return 1;
}
Reply
#7

.........................
Reply
#8

The same way as you store other account information, like password and money. If you don't have an account system in your server, maybe try thinking about implementing one? Otherwise it won't have much effect, as people are not playing 24 hours in a single server.
Reply
#9

................
Reply
#10

If you do this:
Код:
new day = getdate();
It will return the amount of days since the start of the current year. So for 31th of December that will be something like 364 or 365. For 1st of January that will probably be 1. The 1st of February will probably be 32. The 1st of March will probably be something like 60.

More information: getdate()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)