10.06.2012, 14:38
I have been trying to make a vip system where it lasts for like a month but everytime i set my self to level one vip log out and log back in it says your vip has run out
I am saving it fine
Please Help
If you need any more code just ask
Thank You
I am saving it fine
Please Help
pawn Код:
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);
}
}
pawn Код:
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;
}
Thank You