05.06.2017, 06:42
I made this vip system but it wont save the day and the vip level, this is my coding that i made. Its not saving when it should do.
PHP код:
CMD:setvip(playerid, params[])
{
new
string[200],
id,
level,
days
;
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 7)
{
if(sscanf(params, "uii", id, level, days)) return SendClientMessage(playerid,error, "Usage: /setvip [playerid] [level(0/3)] [days]");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Error: Player is not connected.");
if(level < 0 || level > 3) return SendClientMessage(playerid, error, "Max 3 - Min 1.");
if(level == pInfo[id][VIP]) return SendClientMessage(playerid, error, "Player is already that VIP level.");
if(Logged[playerid] == 0) return SendClientMessage(playerid, error, "Player not logged in.");
if(level != 0)
{
if(days < 1 || days > 364) return SendClientMessage(playerid,error, "Min Exp 1 - Max Exp 364 .");
}
if(level >= 1)
{
pInfo[id][ExpVIP] = gettime() + 60*60*24*days;
pInfo[id][VIP] = level;
SaveChar(id);
format(string, 128, "[AdmCmd]: {FF6347} An Administrator has set your vip level to %d for %d days.",level, days);
SendClientMessage(id, red, string);
format(string, 128, "You have set %s vip level to %d for %d days.", GetName(id),level, days);
SendClientMessage(playerid, jblue, string);
return 1;
}
else if(level == 0)
{
days = 0;
pInfo[id][ExpVIP] = 0;
pInfo[id][VIP] = 0;
SaveChar(id);
format(string, 128, "[AdmCmd]: {FF6347} An Administrator has removed your Vip Package.");
SendClientMessage(id, red, string);
format(string, 128, "You have removed %s VIP package.", GetName(id));
SendClientMessage(playerid, jblue, string);
return 1;
}
}
else
{
SendClientMessage(playerid, error, "You are not authorized to use this command.");
}
return 1;
}
//under savechar forward
INI_WriteInt(ACCOUNT, "VIP",pInfo[playerid][VIP]);
INI_WriteInt(ACCOUNT, "ExpVIP",pInfo[playerid][ExpVIP]);
//under loadchar forward
INI_Int("VIP", pInfo[playerid][VIP]);
INI_Int("ExpVIP",pInfo[playerid][ExpVIP]);