OnPlayerConnect(playerid)
{
new timestamp = gettime();
new VIPTimee = Player[playerid][VIPTime];
if(timestamp > VIPTimee)
{
SendClientMessage(playerid, WHITE, "Your VIP has expired if you wish you buy it again please visit the forums");
Player[playerid][VipRank] = 0;
}
else
{
new timeleft = Player[playerid][VIPTime] - timestamp;
new string[50];
format(string, sizeof(string), "You have %i vip hours left", timeleft/3600);
SendClientMessage(playerid, WHITE, string);
}
}
command(changeviplevel, playerid, params[])
{
new level, id, string[128], string2[128];
if(sscanf(params, "ud", id, level))
{
if(Player[playerid][AdminLevel] >= 1)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /changeviplevel [playerid] [level]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 5)
{
if(level > 4 ) return SendClientMessage(playerid, RED, "Avaliable levels 1 - 4");
if(IsPlayerConnectedEx(id))
{
Player[id][VipRank] = level;
if(level == 1)
{
Player[id][VIPTime] = gettime() + 2592000;
}
if(level == 2)
{
Player[id][VIPTime] = gettime() + 2592000;
}
if(level == 3)
{
Player[id][VIPTime] = gettime() + 7776000;
}
if(level == 4)
{
Player[id][VIPTime] = gettime() + 31536000;
}
format(string, sizeof(string), "%s's VIP level has been changed to %d, by %s.", GetName(id), level, GetName(playerid));
format(string2, sizeof(string2), "%s's VIP level has been changed to %d by %s.", GetName(id), level, GetName(playerid));
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i) && Player[i][VipRank] >= 1)
{
SendClientMessage(i, YELLOW, string);
SetPlayerColor(playerid, YELLOW);
}
if(level == 0)
{
SendClientMessage(i, YELLOW, string2);
SetPlayerColor(playerid, WHITE);
}
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
}
return 1;
}
I am saving it fine |
public SavePlayerData(playerid)
{
if(Player[playerid][Authenticated] == 1)
{
GetPlayerPos(playerid, Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ]);
GetPlayerHealth(playerid, Player[playerid][LastHealth]);
GetPlayerArmour(playerid, Player[playerid][LastArmour]);
Player[playerid][LastInterior] = GetPlayerInterior(playerid);
new string[128];
if(Player[playerid][AdminDuty] >= 1)
{
format(string, sizeof(string), "Accounts/%s.ini", Player[playerid][NormalName]);
}
else
{
format(string, sizeof(string), "Accounts/%s.ini", GetName(playerid));
}
if(!fexist(string))
{
dini_Create(string);
}
dini_Set(string, "Password", Player[playerid][Password]);
dini_IntSet(string, "AdminLevel", Player[playerid][AdminLevel]);
dini_FloatSet(string, "LastX", Player[playerid][LastX]);
dini_FloatSet(string, "LastY", Player[playerid][LastY]);
dini_FloatSet(string, "LastZ", Player[playerid][LastZ]);
dini_IntSet(string, "LastWorld", Player[playerid][LastWorld]);
dini_IntSet(string, "LastInterior", Player[playerid][LastInterior]);
if(Player[playerid][AdminDuty] == 0)
{
dini_IntSet(string, "LastSkin", GetPlayerSkin(playerid));
}
dini_IntSet(string, "VIPTime", Player[playerid][VIPTime]);
}
public RegisterPlayer(playerid, password[])
{
new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "Accounts/%s.ini", Name);
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
if(!fexist(string))
{
dini_IntSet(string, "VIPTime", Player[playerid][VIPTime]);
public OnPlayerLoginAttempt(playerid, password[])
{
new string[128], Year, Month, Day, Minute, Hour, Second, Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), "Accounts/%s.ini", Name);
if(Player[playerid][LoginAttempts] == 3)
{
new hour, minute, second, day, year, month;
gettime(hour, minute, second);
getdate(year, month, day);
#pragma unused second
new IP[21];
GetPlayerIp(playerid, IP, sizeof(IP));
format(string, sizeof(string), "%d/%d/%d | %d:%d | %s | %s | THREE FAILED PASSWORD ATTEMPTS | System", day, month, year, hour, minute, IP, Name);
BanLog(string);
SendClientMessage(playerid, ADMINORANGE, "You have used your three attempts.");
Ban(playerid);
}
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
if(fexist(string))
{
if(strcmp(dini_Get(string, "Password"), password, false) == 0)
{
Player[playerid][VIPTime] = dini_Int(string, "VIPTime");
new timestamp = gettime();
new VIPTimee = Player[playerid][VIPTime];
if(timestamp > VIPTimee)
{
SendClientMessage(playerid, WHITE, "Your VIP has expired if you wish you buy it again please visit the forums");
Player[playerid][VipRank] = 0;
}
else
{
new timeleft = Player[playerid][VIPTime] - timestamp;
new string[50];
format(string, sizeof(string), "You have %i vip hours left", timeleft/3600);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(dini_Get(string, "Password"), password, false) == 0)
See, it checks if you have VIPTime left, BEFORE it actually loads your vip time.
pawn Код:
pawn Код:
|