VIP System help.
#1

Hello dear samp members.. Once again I need your pressure help.

So I'm trying to make a trial vip system.. Basically vip for 2 days.

the timer is good etc. But idk if is saving correctly..
under OnPlayerUpdate:
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(PlayerInfo[playerid][VET] 0 < gettime() && PlayerInfo[playerid][VET] > 0 PlayerInfo[playerid][pVIP] != 0)
    {
        new Nam[MAX_PLAYER_NAME]
        GetPlayerName(playerid,Nam,sizeof(Nam));
        SendClientMessage(playerid,-1,"You are no longer vip");
        //this line sets the player log VipExpire = 0
        PlayerInfo[playerid][VET] = 0;
        PlayerInfo[playerid][pVIP] = 0;
    }
    return 1;
}
[Commands:
pawn Код:
YCMD:vipstats(playerid, params[],help)
{
    new TotalVipTime, Days, Hours, Minutes, Msg[200];
    TotalVipTime = PlayerInfo[playerid][VET] - 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;
)
YCMD:settrialvip(playerid, params[],help)
{
    new vlevel,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
    if(!IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] < 8)
    {
         SendClientMessage(playerid,COLOR_RED,"You aren't allowed to use this command.");
    }
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 8)
    {
        if(sscanf(params,"ui",ID,vlevel)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setvip [playerid / partofname] [Level 1-3]");
        if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid,0xFF0000FF, "That user is not connected.");
        if(vlevel > 3) return SendClientMessage(playerid,0xFF0000FF,"AVAILABLE VIP LEVELS 1-3!");
        if(vlevel == 0)//if you select vip level 0
        {
            if(PlayerInfo[ID][pVIP] == 0) return SendClientMessage(playerid,0xFF0000FF,"ERROR: That person is already level 0 vip!");
            GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
            GetPlayerName(ID,pname,MAX_PLAYER_NAME);
            format(str, sizeof(str),"%s has set your VIP Level to 0!",Nam);
            SendClientMessage(ID,0xFF9900AA,str);
            format(str,sizeof(str),"You had set %s VIP Level to 0!",pname);
            SendClientMessage(playerid,0xFF9900AA,str);
            PlayerInfo[playerid][VipExpire] = gettime() + (172800);
            PlayerInfo[ID][pVIP] = 0;
        }
        if(vlevel == 1)
        {
            if(PlayerInfo[ID][pVIP] == 1) return SendClientMessage(playerid,0xFF0000FF,"ERROR: That person is already level 1 vip!");
            GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
            GetPlayerName(ID,pname,MAX_PLAYER_NAME);
            format(str, sizeof(str),"%s has set your VIP Level to 1 (BRONZE VIP FOR 2 DAYS)!",Nam);
            SendClientMessage(ID,0xFF9900AA,str);
            format(str, sizeof(str),"You had set %s VIP Level to 1 (BRONZE VIP FOR 2 DAYS)!",pname);
            SendClientMessage(playerid,0xFF9900AA,str);
            PlayerInfo[playerid][VTE] = gettime() + (172800);
            PlayerInfo[ID][pVIP] = 1;
        }
        if(vlevel == 2)
        {
            if(PlayerInfo[ID][pVIP] == 2) return SendClientMessage(playerid,0xFF0000FF,"ERROR: That person is already level 2 vip!");
            GetPlayerName(ID,pname,MAX_PLAYER_NAME);
            format(str, sizeof(str),"%s has set your VIP Level to 2 (SILVER VIP FOR 2 DAYS)!",Nam);
            SendClientMessage(ID,0xFF9900AA,str);
            format(str, sizeof(str),"You had set %s VIP Level to 2 (SILVER VIP FOR 2 DAYS)!",pname);
            SendClientMessage(playerid,0xFF9900AA,str);
            PlayerInfo[playerid][VipExpire] = gettime() + (172800);
            PlayerInfo[ID][pVIP] = 2;
        }
        if(vlevel == 3)
        {
            if(PlayerInfo[ID][pVIP] == 3) return SendClientMessage(playerid,0xFF0000FF,"ERROR: That person is already level 3 vip!");
            GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
            GetPlayerName(ID,pname,MAX_PLAYER_NAME);
            format(str, sizeof(str),"%s has set your VIP Level to 3 (GOLD VIP FOR 2 DAYS)!",Nam);
            SendClientMessage(ID,0xFF9900AA,str);
            format(str, sizeof(str),"You had set %s VIP Level to 3 (GOLD VIP FOR 2 DAYS)!",pname);
            SendClientMessage(playerid,0xFF9900AA,str);
            PlayerInfo[playerid][VTE] = gettime() + (5184000);
            PlayerInfo[ID][pVIP] = 3;
        }
    }
    return 1;
}
Umm the question is am I setting all correctly?
Reply
#2

You missed ";" in 5th line
Reply
#3

Thanks for that but still question is up (anyway +rep)
Reply
#4

it wont save unless you have it in your database/ini to save. Setting PlayerInfo will save the info while the player is connected, but it's lost once the server restarts.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)