02.07.2012, 16:09
Yea you have to divide...but heres a snipit from my dialog vip system . It uses unix timestamp, wich i assume you used, and calculates the days, miuntes, and seconds. I learned how to do this from a tutoral so it isnt perfect but it works.
And that will tell the player how much time they have left.
also i dont know how you fill the varaible for how much time the player has but here is how it would work
Hope that works for you and hope you understand how it works.
pawn Код:
command(stats, playerid, params[])
{
new TotalVipTime, Days, Hours, Minutes, Msg[200];
TotalVipTime = Player[playerid][VipExpiredTime] - gettime();//here it will get the time stamp saved in the player variable
if (TotalVipTime >= 86400)
{
Days = TotalVipTime / 86400;
TotalVipTime = TotalVipTime - (Days * 86400);//here it calculates the days
}
if (TotalVipTime >= 3600)
{
Hours = TotalVipTime / 3600;
TotalVipTime = TotalVipTime - (Hours * 3600);//calculates the seconds
}
if (TotalVipTime >= 60)
{
Minutes = TotalVipTime / 60;
TotalVipTime = TotalVipTime - (Minutes * 60);//calculates the minutes
}
format(Msg, 200, "{00CED1}Remaining Vip: {FFFFFF}Days: {00A400}%i{FFFFFF}, Hours: {00A400}%i{FFFFFF}, Minutes: {00A400}%i{FFFFFF}\n", Days, Hours, Minutes);
SendClientMessage(playerid,-1,Msg)
return 1;
)
also i dont know how you fill the varaible for how much time the player has but here is how it would work
pawn Код:
Player[playerid][VipExpiredTime] = gettime()+(Your_ammount_of_days*86400);