09.06.2012, 22:12
How comes this VIP timer dont work ? I have been trying for ages please help me
Thank You
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)
{
new VIPTime = gettime() + 2592000;
SetPVarInt(playerid, "VIPTime", VIPTime);
}
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;
}
pawn Код:
OnPlayerConnect(playerid)
{
new timestamp = gettime();
new VIPTime = GetPVarInt(playerid, "VIPTime");
if(timestamp > VIPTime)
{
SendClientMessage(playerid, WHITE, "Your VIP has been taken away because the VIP time is up");
Player[playerid][VipRank] = 0;
}
else
{
SendClientMessage(playerid, WHITE, "Hi");
}
}