17.05.2015, 09:20
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)
ondialogresponse
onplayerconnect
onplayerupdate
the problem is the code doesnt make vip expired
plzz is there any wrong ??
sry for my bad english
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; }
Код:
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"); } } } }
Код:
if(gettime() > PlayerInfo[playerid][VipTime]) { PlayerInfo[playerid][VipLevel] = 0; }
Код:
PlayerInfo[playerid][VipTime] -= gettime();
plzz is there any wrong ??
sry for my bad english