Код:
public CronServe()
{
new string[256];
minu++;
if(horas == 0)
{
SetWorldTime(0);
Faculdade2 = 0;
}
if(minu >= 59)
{
minu = 0;
horas++;
SetWorldTime(horas);
}
if(horas > 23)
{
horas = 0;
}
if(Relogio != Text:INVALID_TEXT_DRAW)
{
format(string, 25, "~w~%02d~g~:~w~%02d", horas, minu);
TextDrawSetString(Relogio, string);
}
if(horas == 9 && minu == 00)
{
Faculdade2 = 1;
MoveDynamicObject(ObjectsFix[21], 1214.0789794922, -1842.5186767578, 20.415674209595, 4.0);
MoveDynamicObject(ObjectsFix[22], 1269.8895263672, -1842.5379638672, 20.511180877686, 4.0);
GameTextForAll("~w~Faculdade ~p~Aberta!", 6000, 1);
}
if(horas == 12 && minu == 00)
{
Faculdade2 = 0;
MoveDynamicObject(ObjectsFix[21], 1213.7843017578, -1842.4782714844, 15.156204223633, 4.0);
MoveDynamicObject(ObjectsFix[22], 1270.2001953125, -1842.5798339844, 15.156204223633, 4.0);
GameTextForAll("~w~Faculdade ~p~Fechada!", 6000, 1);
}
if(horas == 14 && minu == 00)
{
Faculdade2 = 1;
MoveDynamicObject(ObjectsFix[21], 1214.0789794922, -1842.5186767578, 20.415674209595, 4.0);
MoveDynamicObject(ObjectsFix[22], 1269.8895263672, -1842.5379638672, 20.511180877686, 4.0);
GameTextForAll("~w~Faculdade ~p~Aberta!", 6000, 1);
}
if(horas == 17 && minu == 00)
{
Faculdade2 = 0;
MoveDynamicObject(ObjectsFix[21], 1213.7843017578, -1842.4782714844, 15.156204223633, 4.0);
MoveDynamicObject(ObjectsFix[22], 1270.2001953125, -1842.5798339844, 15.156204223633, 4.0);
GameTextForAll("~w~Faculdade ~p~Fechada!", 6000, 1);
}
if(horas == 21 && minu == 00)
{
Faculdade2 = 1;
MoveDynamicObject(ObjectsFix[21], 1214.0789794922, -1842.5186767578, 20.415674209595, 4.0);
MoveDynamicObject(ObjectsFix[22], 1269.8895263672, -1842.5379638672, 20.511180877686, 4.0);
GameTextForAll("~w~Faculdade ~p~Aberta!", 6000, 1);
}
if(horas == 24 && minu == 30)
{
Faculdade2 = 0;
MoveDynamicObject(ObjectsFix[21], 1213.7843017578, -1842.4782714844, 15.156204223633, 4.0);
MoveDynamicObject(ObjectsFix[22], 1270.2001953125, -1842.5798339844, 15.156204223633, 4.0);
GameTextForAll("~w~Faculdade ~p~Fechada!", 6000, 1);
}
if(horas == 15 && minu == 00)
{
print("Salбrio pago ao(s) empregado(s) online!");
Up();
}
totalon = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(!IsPlayerNPC(i))
{
if(totalon == 0)
{
totalon = 1;
}
else if(totalon > 0)
{
totalon++;
}
}
if(GetPlayerMoney(i) != GetPlayerGrana(i))
{
ResetPlayerMoney(i);
GivePlayerMoney(i, GetPlayerGrana(i));
}
GetPlayerPos(i, PlayerCurrentPos[0], PlayerCurrentPos[1], PlayerCurrentPos[2]);
if(!floatcmp(PlayerCurrentPos[0], PlayerLastPos[i][LastX]) && !floatcmp(PlayerCurrentPos[1], PlayerLastPos[i][LastY]))
{
PlayerAfkTicks[i]++;
}
else
{
PlayerAfkTicks[i] = 0;
}
PlayerLastPos[i][LastX] = PlayerCurrentPos[0];
PlayerLastPos[i][LastY] = PlayerCurrentPos[1];
PlayerLastPos[i][LastZ] = PlayerCurrentPos[2];
if(PlayerAfkTicks[i] == MAX_IDLE_TIME*60 && PlayerInfo[i][Logged] == 1)
{
AFK[i] = 1;
SetPlayerVirtualWorld(i, 1);
SetCameraBehindPlayer(i);
TogglePlayerControllable(i, 0);
TextDrawShowForPlayer(i, AfkText);
TextDrawShowForPlayer(i, AfkBackText);
format(string, sizeof(string), "%s estб ausente e foi impedido(a) de upar!", GetPlayerNameEx(i));
SendClientMessageToAll(0xFF9595AA, string);
}
format(file, sizeof(file), PASTA_CONTAS, GetPlayerNameEx(i));
if(dini_Exists(file))
{
new Float:health;
GetPlayerHealth(i, health);
dini_IntSet(file, "Matou", matou[i]);
dini_IntSet(file, "Morreu", morreu[i]);
if(dini_Int(file, "usoudroga") == 1)
{
SetPlayerHealth(i, health-2);
}
if(dini_Int(file, "Level") > MAX_PLAYER_LEVEL-1)
{
dini_IntSet(file, "Level", MAX_PLAYER_LEVEL);
}
if(dini_Int(file, "Faculdade") > MAX_PLAYER_ESTUDO-1)
{
dini_IntSet(file, "Faculdade", MAX_PLAYER_ESTUDO);
}
if(pAdmin[i] > 0)
{
dini_IntSet(file, "Admin", pAdmin[i]);
}
}
}
}
return 1;
}