temporary vip/donator problem
#1

hey there i have problem with my vip system script i already search and try some tutorial but not working here is my code
im using dialog
on set vip (shows the dialog)
Код:
CMD:mshop(playerid, params[])
{
    ShowPlayerDialog(playerid, DIALOG_mshop, DIALOG_STYLE_LIST, ""COL_YELLOW"Mshop","Buy VIP For 30 Days (30 Mcoin)\nBuy VIP For 7 Days (7 Mcoin)", "Buy", "Cancel");
    return 1;
}
ondialogresponse
Код:
if(dialogid == DIALOG_mshop)
	{
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0:
	            {
	        	if(PlayerInfo[playerid][mcoin] < 30) return SendClientMessage(playerid, -1, "You Dont Have Enough Mcoin Plss Buy It!");
	        	PlayerInfo[playerid][mcoin] -= 30;
	        	PlayerInfo[playerid][VipLevel] = 1;
	        	PlayerInfo[playerid][VipTime] +=gettime()+2592000;
	        	new string1[90], tname[MAX_PLAYER_NAME], string2[90], file[300];
	   			GetPlayerName(playerid, tname, sizeof(tname));
				format(file,sizeof(file),"nAdmin/Users/%s.ini",tname);
	    		dini_IntSet(file,"VipLevel",1);
	    		dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipLevel]);
	    		GetPlayerName(playerid, aname, sizeof(aname));
	    		format(string1, sizeof(string1), "%s has Buy Level 1 VIP for 30 days from /mshop", tname);
	    		SendClientMessageToAll(COLOR_GREEN, string1);
	    		GameTextForPlayer(playerid, "Congratulations!", 2000, 5);
	        	SendClientMessage(playerid, -1, "You Have Buy VIP Level 1 For 30 Mcoin for 30 Days from /mshop");
				}
				case 1:
				{
                	if(PlayerInfo[playerid][mcoin] < 7) return SendClientMessage(playerid, -1, "You Dont Have Enough Mcoin Plss Buy It!");
	        		PlayerInfo[playerid][mcoin] -= 7;
	        		PlayerInfo[playerid][VipLevel] = 1;
	        		PlayerInfo[playerid][VipTime] +=gettime()+604800;
	        		new string1[90], tname[MAX_PLAYER_NAME], string2[90], file[300];
	   			GetPlayerName(playerid, tname, sizeof(tname));
				format(file,sizeof(file),"nAdmin/Users/%s.ini",tname);
	    			dini_IntSet(file,"VipLevel",1);
	    			dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipLevel]);
	    			GetPlayerName(playerid, aname, sizeof(aname));
	    			format(string1, sizeof(string1), "%s has Buy Level 1 VIP for 7 days from /mshop", tname);
	    			SendClientMessageToAll(COLOR_GREEN, string1);
	    			GameTextForPlayer(playerid, "Congratulations!", 2000, 5);
	        		SendClientMessage(playerid, -1, "You Have Buy VIP Level 1 For 7 Mcoin for 7 Days from /mshop");
				}
			}
		}
	}
onplayerconnect
Код:
if(gettime() > PlayerInfo[playerid][VipTime])
	{
	PlayerInfo[playerid][VipLevel] = 0;
	}
onplayerupdate
Код:
PlayerInfo[playerid][VipTime] -= gettime();
the problem is the code doesnt make vip expired
plzz is there any wrong ??

sry for my bad english
Reply
#2

Код:
if(dialogid == DIALOG_mshop)
	{
	    if(response)
	    {
	        switch(listitem)
	        {
	            case 0:
	            {
	        	if(PlayerInfo[playerid][mcoin] < 30) return SendClientMessage(playerid, -1, "You Dont Have Enough Mcoin Plss Buy It!");
	        	PlayerInfo[playerid][mcoin] -= 30;
	        	PlayerInfo[playerid][VipLevel] = 1;
	        	PlayerInfo[playerid][VipTime] +=gettime()+2592000;
	        	new string1[90], tname[MAX_PLAYER_NAME], string2[90], file[300];
	   			GetPlayerName(playerid, tname, sizeof(tname));
				format(file,sizeof(file),"nAdmin/Users/%s.ini",tname);
	    		dini_IntSet(file,"VipLevel",1);
	    		dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipLevel]);  set it // dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipTime]);
	    		GetPlayerName(playerid, aname, sizeof(aname));
	    		format(string1, sizeof(string1), "%s has Buy Level 1 VIP for 30 days from /mshop", tname);
	    		SendClientMessageToAll(COLOR_GREEN, string1);
	    		GameTextForPlayer(playerid, "Congratulations!", 2000, 5);
	        	SendClientMessage(playerid, -1, "You Have Buy VIP Level 1 For 30 Mcoin for 30 Days from /mshop");
				}
				case 1:
				{
                	if(PlayerInfo[playerid][mcoin] < 7) return SendClientMessage(playerid, -1, "You Dont Have Enough Mcoin Plss Buy It!");
	        		PlayerInfo[playerid][mcoin] -= 7;
	        		PlayerInfo[playerid][VipLevel] = 1;
	        		PlayerInfo[playerid][VipTime] +=gettime()+604800;
	        		new string1[90], tname[MAX_PLAYER_NAME], string2[90], file[300];
	   			GetPlayerName(playerid, tname, sizeof(tname));
				format(file,sizeof(file),"nAdmin/Users/%s.ini",tname);
	    			dini_IntSet(file,"VipLevel",1);
	    			dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipLevel]);  set it // dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipTime]);
	    			GetPlayerName(playerid, aname, sizeof(aname));
	    			format(string1, sizeof(string1), "%s has Buy Level 1 VIP for 7 days from /mshop", tname);
	    			SendClientMessageToAll(COLOR_GREEN, string1);
	    			GameTextForPlayer(playerid, "Congratulations!", 2000, 5);
	        		SendClientMessage(playerid, -1, "You Have Buy VIP Level 1 For 7 Mcoin for 7 Days from /mshop");
				}
			}
		}
	}
Hope this will work.
Reply
#3

but i already define the
PlayerInfo[playerid][VipTime] lke this

Quote:

PlayerInfo[playerid][VipTime] += gettime()+2592000; then i use
dini_IntSet(file,"VipTime", PlayerInfo[playerid][VipLevel]);

Reply
#4

I know you defined that but look carefully what you did.
Your dini_IntSet() saving player's VIP level at player's duration of VIP (time)
Reply
#5

About the saving mistake look above ^.

Also, you should set the unix timestamp for that day not to add it to the previous value.

So replace with:
pawn Код:
PlayerInfo[playerid][VipTime] =gettime()+2592000;
...
PlayerInfo[playerid][VipTime] =gettime()+604800;
and remove:
pawn Код:
PlayerInfo[playerid][VipTime] -= gettime();
completely.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)