SA-MP Forums Archive
How can i show VIP days - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How can i show VIP days (/showthread.php?tid=356136)



How can i show VIP days - Euan Hughes - 02.07.2012

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


Re: How can i show VIP days - Euan Hughes - 02.07.2012

Would i have the divide the variable by anything

Please help

Thanks


Re: How can i show VIP days - nickdodd25 - 02.07.2012

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.