How can i show VIP days
#1

Well i have been creating a VIP system it is working alright but i just need to know how can i make this ..

When someone does /stats it will show

pawn Код:
command(stats, playerid, params[])
{
        VIP: (number here) Days left
}
I save the seconds left they have for VIP in a variable but i want it for days the variable is this..

pawn Код:
Player[playerid][VipExpiredTime]
If you need any more code just ask

Thanks
Reply
#2

Would i have the divide the variable by anything

Please help

Thanks
Reply
#3

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.


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;
)
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
pawn Код:
Player[playerid][VipExpiredTime] = gettime()+(Your_ammount_of_days*86400);
Hope that works for you and hope you understand how it works.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)