SetTimer for so many days?
#8

Quote:
Originally Posted by Goldilox
Посмотреть сообщение
Is that pattern correct?

pawn Код:
CMD:changename(playerid,params[])
{

new expiration_date_time = gettime() + 86400;
if(gettime() >= expiration_date_time)
{
   ChangeName();
}
else
{
SendClientMessage(playerid,0xFFFFFFAA,"Spent a day faggot!";
return 1;
}
return 1;
}
no because you're setting the variable and then checking so it'll never be true

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;
}
and then save the variable to their user file and load when they quit/join
Reply


Messages In This Thread
SetTimer for so many days? - by Goldilox - 17.06.2013, 05:18
Respuesta: SetTimer for so many days? - by JustBored - 17.06.2013, 05:26
Re: SetTimer for so many days? - by MP2 - 17.06.2013, 05:35
Re: SetTimer for so many days? - by Goldilox - 17.06.2013, 20:19
AW: SetTimer for so many days? - by BigETI - 17.06.2013, 20:28
Re: SetTimer for so many days? - by Goldilox - 17.06.2013, 21:02
AW: SetTimer for so many days? - by BigETI - 17.06.2013, 22:51
Re: SetTimer for so many days? - by cessil - 17.06.2013, 23:26
Re: SetTimer for so many days? - by Goldilox - 18.06.2013, 16:27

Forum Jump:


Users browsing this thread: 4 Guest(s)