SA-MP Forums Archive
auto vip remove - 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: auto vip remove (/showthread.php?tid=597049)



auto vip remove - GeneralAref - 26.12.2015

guys how to make timer for auto remove vip?


Re: auto vip remove - $Marco$ - 26.12.2015

Here you go;
https://sampwiki.blast.hk/wiki/SetTimerEx


Re: auto vip remove - GeneralAref - 26.12.2015

and if player disconnected?


Re: auto vip remove - SaltySandy - 26.12.2015

Make the timer update when he comes online...


Re: auto vip remove - AmigaBlizzard - 26.12.2015

If you want to remove VIP automatically after 24 hours for example, you can simply get the current time when your player acquires his VIP status using gettime().
This will return a timestamp in seconds that have passed since january 1970 or so.
Just add 24*60*60 (= 86400) to that value to get the time his VIP status should end.

Then simply save that value when he disconnects and reload it when he logs in again.
And when he wants to use his VIP commands or whatever, just check if the current time is still lower than his VIP-time (if so, he still has VIP status).


Re: auto vip remove - GeneralAref - 27.12.2015

i found this but given me 2 error: undefined symbol "timestamp"
PHP код:
if(timestamp() >= GetPVarInt(playerid,"VIPExpiration"))
{
    
SetPVarInt(playerid"VIP"0);
    
SendClientMessage(playerid0xFF0000FF"Your VIP time has expired.");

PHP код:
SetPVarInt(playerid,"VIPExpiration"timestamp()+2592000); 



Re: auto vip remove - Ritzy2K - 27.12.2015

Did you wrote it? dont just copy and paste the snippets.


Re: auto vip remove - GeneralAref - 27.12.2015

i say how to fix that.


Re: auto vip remove - GeneralAref - 27.12.2015

i make this code but Subtract the year of vipdays.
PHP код:
new YearMonthDay;
    
getdate(YearMonthDay);
    new 
Days getdate(), name[MAX_PLAYER_NAME], str[128];
    if(
PlayerInfo[playerid][pVip] >= 1)
    {
        
GetPlayerName(playeridnamesizeof(name));
         
format(strsizeof(str),"/Asystem/Users/%s.ini",name);
        new 
INI:ini INI_Open(str);
        
INI_SetTag(ini,"data");
         
INI_WriteInt(ini,"Vipdays",PlayerInfo[playerid][pVipdays] -= Day);
        
INI_Close(ini);
    }
    if(
PlayerInfo[playerid][pVip] >= 1)
    {
        if(
PlayerInfo[playerid][pVipdays] < Days)
        {
            
GetPlayerName(playeridnamesizeof(name));
             
format(strsizeof(str),"/Asystem/Users/%s.ini",name);
            new 
INI:ini INI_Open(str);
            
INI_SetTag(ini,"data");
             
INI_WriteInt(ini,"Vipdays",0);
             
INI_WriteInt(ini,"Vip",0);
            
INI_Close(ini);
            
SendClientMessage(playeridCOLOR_RED"Your vip has ended!if you want to buy vip , visit our website:");
        }
    } 



Re: auto vip remove - GeneralAref - 27.12.2015

i need this code plz
i change it to this but i dont know how to off vip after 30.
and this is my setvip code:
PHP код:
CMD:setvip(playeridparams[])
{
    new 
victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], viplvlidtmp[128], name[MAX_PLAYER_NAME];
    if(
PlayerInfo[playerid][pAdmin] >= CmdsOptions[setvip] || IsPlayerAdmin(playerid))
    {
        if (
sscanf(params"ui"idviplvl)) return SendClientMessage(playeridCOLOR_RED"USAGE: /setvip [id] [Viplevel]");
        if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"[ERROR]:Invalid ID");
        if (
viplvl || viplvl 0) return SendClientMessage(playeridCOLOR_RED,"[ERROR]:Valid Vip Levels: 1-5!");
        
PlayerInfo[id][pVip] = viplvl;
        
GetPlayerName(idvictimnamesizeof(victimname));
        
GetPlayerName(playeridadminnamesizeof(adminname));
        
GetPlayerName(idnamesizeof(name));
        
format(tmpsizeof(tmp),"/Asystem/Users/%s.ini",name);
        new 
YearMonthDay;
        
getdate(YearMonthDay);
        
Day += 30;
        new 
INI:ini INI_Open(tmp);
        
INI_SetTag(ini,"data");
        
INI_WriteInt(ini,"Vipdays",Day);
        
INI_Close(ini);
        new 
str[128];
        
format(str,128,"Admin %s v has set %s [ID %d] vip level to %i",adminnameplayeridvictimnameidviplvl);
        
SendClientMessage(playerid,COLOR_BLUE,str);
        new 
string[128];
        
format(string,128,"Admin %s (id:%d) has set your vip level to %i",adminnameplayeridviplvl);
          
SendClientMessage(id,COLOR_BLUE,string);
        return 
1;
    }
    else return 
SendClientMessage(playerid,COLOR_RED,"You do not have permission to use this command!");