05.06.2017, 16:36
Код:
CMD:setvip(playerid, params[]) { new string[200], id, level, days, fxVip; 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(days < 1 || days > 364) return SendClientMessage(playerid,error, "Min Exp 1 - Max Exp 364 ."); if(level == 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; } fxVip = gettime() + days * 86400; pInfo[id][ExpVIP] = fxVip; 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); } 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]);