28.06.2016, 18:25
I have a vip shop in my script, which has token points.
From this script, when I try to buy an item from listitem 1 or 2, I get the not enough tokens message and in my user file the tokens are written as 100. However, listitem 0 and listitem 3 do not require tokens to buy. Also, I have these 2 lines in the code
but the token number is not written in the user file, it still remains 100.
Код:
if(dialogid == DIALOG_VIP_SHOP) { if(response) { new INI: File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File, "VIP Tokens", Player[playerid][pTokens]); INI_Close(File); if(listitem == 0) { if( Player[playerid][pTokens] < 100 ) { SCM(pid, ADMIN_COLOR, " You don't have enough tokens!"); return 1; } else { SetPVarInt(playerid, Player[playerid][pVip], 1 ); Player[playerid][pVip] = 1; SCM(pid, -1, " {FFFFFF}You have bought the {AE05FC}VIP Level 1{FFFFFF} privilege!"); return 1; } } if(listitem == 1) { if( Player[playerid][pTokens] < 200 ) { SCM(pid, ADMIN_COLOR, " You don't have enough tokens!"); return 1; } else { SetPVarInt(playerid, Player[playerid][pVip], 2 ); Player[playerid][pVip] = 2; SCM(pid, -1, " {FFFFFF}You have bought the {FF00FF}VIP Level 2{FFFFFF} privilege!"); return 1; } } if(listitem == 2) { if( Player[playerid][pTokens] < 300 ) { SCM(pid, ADMIN_COLOR, " You don't have enough tokens!"); return 1; } else { SetPVarInt(playerid, Player[playerid][pVip], 3 ); Player[playerid][pVip] = 3; SCM(pid, -1, " {FFFFFF}You have bought the {FF1FAD}VIP Level 3{FFFFFF} privilege!"); return 1; } } if(listitem == 3) { if( Player[playerid][pTokens] < 30 ) { SCM(pid, ADMIN_COLOR, " You don't have enough tokens!"); return 1; } else { GivePlayerMoney(playerid, 500000); SCM(pid, -1, " {FFFFFF}You have bought {09FF00}$500.000{FFFFFF} with tokens!"); return 1; } } return 1; } }
Код:
SetPVarInt(playerid, Player[playerid][pTokens], token); token = Player[playerid][pTokens] - 100;