VIP System HELP!
#6

Quote:
Originally Posted by lynxhero1337
Посмотреть сообщение
Ohhh, i thought the timestamp will be readable numbers.
Can you give me an example how to use the ConvertToDaysAndHours to save in y_ini?
Thanks btw i am learning!
pawn Код:
CMD:setvip(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, -1, "You are not authorised to use this command.");
    new giveplayerid, level, days, hours;
    if(sscanf(params, "uddd", giveplayerid, level, days, hours))
        return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setvip [playerid] [level] [days] [hours]") &&
        SendClientMessage(playerid, COLOR_SIVA, "Available Levels: |0| None |1| Bronze |2| Silver |3| Gold |4| Platinum |5| Moderator");
    if(!IsPlayerConnected(giveplayerid) || giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not connected.");
    if(!(0 <= level <= 5)) return SendClientMessage(playerid, COLOR_SIVA, "VIP Level can not be below 0 or above 5.");
    if(!(0 <= days <= 30)) return SendClientMessage(playerid, COLOR_SIVA, "VIP Days can't be bigger than 30 days.");
    if(!(0 <= hours <= 23)) return SendClientMessage(playerid, COLOR_SIVA, "VIP Hours can't be bigger than 23 hours.");
    new string[128], viptime = (gettime() + ConvertToSeconds(.days = days, .hours = hours));
    PlayerInfo[giveplayerid][pVipRank] = level;
    PlayerInfo[giveplayerid][pVipTime] = viptime;
    new INI:File = INI_Open(DonatorPath(playerid));
    INI_SetTag(File, "data");
    INI_WriteInt(File, "VipTime", ConvertToSeconds(0, 0, days, hours, 0, 0);
    INI_WriteInt(File, "VipRank", PlayerInfo[giveplayerid][pVipRank]);
    INI_Close(File);
    new rank[15];
    switch(level)
    {
        case 0: rank = "Normal Player";
        case 1: rank = "Bronze VIP";
        case 2: rank = "Silver VIP";
        case 3: rank = "Gold VIP";
        case 4: rank = "Platinum VIP";
        case 5: rank = "Moderator";
    }
    format(string, sizeof(string), "You have been given a %s status.", rank);
    SendClientMessage(giveplayerid, -1, string);
    format(string, sizeof(string), "You have given a %s status.", rank);
    SendClientMessage(playerid, -1, string);
    return 1;
}
Now everytime you set someone VIP for, example, 1 day, it'll show 86400 in the .ini file, instead of that UNIX timestamp.
Reply


Messages In This Thread
VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:13
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:19
Re: VIP System HELP! - by SymonClash - 14.03.2019, 20:21
Re: VIP System HELP! - by PoniStar - 14.03.2019, 20:22
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:26
Re: VIP System HELP! - by SymonClash - 14.03.2019, 20:36
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:46
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:48
Re: VIP System HELP! - by SymonClash - 14.03.2019, 20:49
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 20:53
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 22:15
Re: VIP System HELP! - by lynxhero1337 - 14.03.2019, 23:06
Re: VIP System HELP! - by N3cromancer - 16.03.2019, 08:04
Re: VIP System HELP! - by lynxhero1337 - 18.03.2019, 13:52

Forum Jump:


Users browsing this thread: 1 Guest(s)