17.06.2013, 05:18
What I want to do is that player can only type this command once in a day, how would I set that?
Is it gonna be like SetTimer for 86400000 ms?
Is it gonna be like SetTimer for 86400000 ms?
if(gettime() < the_value_you_saved_to_their_account) return SendClientMessage(playerid, COLOR_RED, "You can only use this command once a day.");
expiration_date_time = gettime()+delay // "delay" in seconds!
if(gettime() >= expiration_date_time)
CMD:changename(playerid,params[])
{
new expiration_date_time = gettime() + 86400;
if(gettime() >= expiration_date_time)
{
ChangeName();
}
else
{
SendClientMessage(playerid,0xFFFFFFAA,"Spent a day!";
return 1;
}
return 1;
}
Is that pattern correct?
pawn Код:
|
#define TimeHour 3600
#define TimeDay 86400
new expiration_date_time[MAX_PLAYERS];
CMD:changename(playerid,params[])
{
if(expiration_date_time[playerid] < gettime())
{
expiration_date_time[playerid] = gettime() + TimeDay;
ChangeName();
}
else//else the variable is greater than the current time
{
SendClientMessage(playerid,0xFFFFFFAA,"You can only use this command once every 24 hours, Friend!";
return 1;
}
return 1;
}