Help .
#1

I WANT DO SET VIP TIME IS 30DAYS , BUT ME DON'T KNOW TIME.
i use .ini
Code:
Код:
CMD:setvip(playerid,params[])
{
    
    if(pInfo[playerid][pAdminLevel] >= 5)
    {
    new targetid,level,string[256],months;
    if(sscanf(params, "ud", targetid, level,months)) 
    {
        SendClientMessage(playerid,-1,"USAGE: /setvip [player] [level] [months]");
        SendClientMessage(playerid,-1,"Available Levels:  |1| Bronze |2| Silver |3| Gold ");
        return 1;
    }
    format(string, sizeof(string), "%s %s da cho vip %s.",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
    SendClientMessageToAll(-1,string);
    }
    else {
    SendClientMessage(playerid,COLOR_RED,"{FF0000}Ban khong phai admin.!");
    }
    return 1;
}
Reply
#2

It is really simple,
All you do is a command, I see nothing wrong with the codes
/setvip [playerid] [viplevel] 1 <----- 1 = 30 days
Reply
#3

time vip can't end . and save.
Reply
#4

Use timestamps .

Also, please fix the string length on that format();. There's no way a client message is going to be above 144!
Reply
#5

Try this:

PHP код:
stock GetCharacterStuff(szName[], szItem[]) {
        new
            
szItem2[64 MAX_PLAYER_NAME];

        
format(szItem2sizeof(szItem2), "Crumpets, %s and %s"szNameszItem);
        return 
strval(szItem2);
}


public 
OnPlayerConnect(playerid) {
       new
            
szName[MAX_PLAYER_NAME];

        
GetPlayerName(playeridszNameMAX_PLAYER_NAME);

    
// I'm using a pseudo-function here as an example of loading a player variable from a file. This function probably hasn't ever been created and it won't work - it's just an example!
    
SetPVarInt(playerid"vipTime"GetCharacterStuff(szName"vipTime"));
    if(
gettime() > GetPVarInt(playerid"vipTime")) {
                
// Their VIP expired.
                
SendClientMessage(playerid0"Your VIP subscription has expired. You're now a commoner!");
                
DeletePVar(playerid"vipTime"); // Because we won't need it again.
                // They aren't a VIP. We'll say that if 'vipTime' is 0 they're not a VIP, that's okay.
        
}
        return 
1;
}

CMD:givevip(playeridparams[]) {
        new
            
iPerson,
                
iDays;

        if(!
IsPlayerAdmin(playerid)) // Just for the sake of it.
            
return SendClientMessage(playerid0"Only admins can make players VIP!");

        if(
sscanf(params"ui"iPersoniDays)) // We'll use sscanf with our zcmd command for this.
            
return SendClientMessage(playerid0"Usage: /givevip [playerid/name] [days]");

        
// 'iPerson' contains the playerid of the person who should be getting VIP, let's confirm they're connected
        
if(iPerson == INVALID_PLAYER_ID// sscanf returns 'INVALID_PLAYER_ID' if nobody is online with an ID or name similar or matching what you entered
            
return SendClientMessage(playerid0"The person you're trying to give VIP isn't online.");

        
// 'iDays' contains the amount of days we should be giving the person VIP for.
        
if(iDays 365// We'll set a limit so a person can't have longer than a year's worth of VIP for the sake of it too.
            
return SendClientMessage(playerid0"You can't give a player VIP for longer than a year. A year consists of 365 days (if it's not a leap year).");

        
// There are 86400 seconds in a day. We'll do some simple math here, multiple the amount of days by 86400 seconds, because Unix timestamps are essentially seconds
        // ...we're going to be needing to work with seconds. So, here we go. We'll set it to that players' VIP time so they get VIP now too.
        
SetPVarInt(iPerson"vipTime"gettime()+(iDays*86400));
        return 
1;

Reply
#6

PlayerInfo[playerid][pVipDate]+=gettime()+(30*86400);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)