Advertisement
Guest User

Untitled

a guest
May 28th, 2014
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.80 KB | None | 0 0
  1. /*
  2. ||||||||       ||  ||  ||||||       ||||||  |||||||||||  ||||||         ||  ||||||||||||  ||||||||
  3. ||     ||              ||   ||     ||   ||  ||           ||   ||        ||  ||        ||  ||     ||
  4. ||       ||    ||  ||  ||    ||   ||    ||  ||           ||    ||       ||  ||        ||  ||      ||
  5. ||        ||   ||  ||  ||     || ||     ||  ||           ||     ||      ||  ||        ||  ||       ||
  6. ||        ||   ||  ||  ||      ||||     ||  ||           ||      ||     ||  ||        ||  |||||||||||
  7. ||        ||   ||  ||  ||               ||  |||||||||    ||       ||    ||  ||        ||  ||    ||
  8. ||        ||   ||  ||  ||               ||  ||           ||        ||   ||  ||        ||  ||     ||
  9. ||       ||    ||  ||  ||               ||  ||           ||         ||  ||  ||        ||  ||      ||
  10. ||     ||      ||  ||  ||               ||  ||       ||  ||          || ||  ||        ||  ||      ||
  11. ||||||||       ||  ||  ||               ||  |||||||||||  ||           ||||  ||||||||||||  ||       ||*/
  12.  
  13. #include a_samp
  14. #include zcmd
  15. #include DOF2
  16.  
  17. new Acessos;
  18. new PlayerText:AcessosDii[MAX_PLAYERS];
  19. new arquivo[30], texto[50], ano, mes, dia;
  20. new horas,minutos,segundos;
  21.  
  22. public OnPlayerConnect(playerid)
  23. {
  24.     AcessosDii[playerid] = CreatePlayerTextDraw(playerid, 40.000000, 329.000000, "  ");
  25.     PlayerTextDrawColor(playerid, AcessosDii[playerid], 12582911);
  26.     PlayerTextDrawFont(playerid, AcessosDii[playerid], 3);
  27.     PlayerTextDrawBackgroundColor(playerid, AcessosDii[playerid], 255);
  28.     PlayerTextDrawSetShadow(playerid, AcessosDii[playerid], 1);
  29.     PlayerTextDrawSetOutline(playerid, AcessosDii[playerid], 1);
  30.     Acessos ++;
  31.     return 1;
  32. }
  33. public OnFilterScriptInit()
  34. {
  35.     SetTimer("Reset", 1000, false);
  36.     SetTimer("SalvarVisitas", 10*60000, true);
  37.     print("[DIIMENOR] ~ Contador de visitas iniciado com sucesso.");
  38.     getdate(ano, mes, dia);
  39.     format(arquivo, sizeof(arquivo), "Visitas/%i_%i_%i.ini", dia, mes, ano);
  40.     if(DOF2_FileExists(arquivo))
  41.     {
  42.         Acessos = DOF2_GetInt(arquivo, "Visitas");
  43.         DOF2_SaveFile();
  44.     }
  45.     else
  46.     {
  47.         DOF2_CreateFile(arquivo);
  48.         DOF2_SetInt(arquivo, "Visitas", Acessos);
  49.         DOF2_SaveFile();
  50.     }
  51.     return true;
  52. }
  53. public OnFilterScriptExit()
  54. {
  55.     DOF2_Exit();
  56.     return 1;
  57. }
  58. forward SalvarVisitas();
  59. public SalvarVisitas()
  60. {
  61.     getdate(ano, mes, dia);
  62.     format(arquivo, sizeof(arquivo), "Visitas/%i_%i_%i.ini", dia, mes, ano);
  63.     if(DOF2_FileExists(arquivo))
  64.     {
  65.         DOF2_SetInt(arquivo, "Visitas", Acessos);
  66.         DOF2_SaveFile();
  67.         print("Salvo com sucesso");
  68.     }
  69.     else
  70.     {
  71.         DOF2_CreateFile(arquivo);
  72.         DOF2_SetInt(arquivo, "Visitas", Acessos);
  73.         DOF2_SaveFile();
  74.         print("Salvo com sucesso");
  75.     }
  76.     return 1;
  77. }
  78. public OnPlayerSpawn(playerid)
  79. {
  80.     format(texto, sizeof(texto), "{FFFFFF}Você é visitante de numero: {00FFFF}%i", Acessos);
  81.     SendClientMessage(playerid, -1, texto);
  82.     PlayerTextDrawShow(playerid, AcessosDii[playerid]);
  83.     return 1;
  84. }
  85. public OnPlayerUpdate(playerid)
  86. {
  87.     new string[20];
  88.     format(string, sizeof(string), "Visitas: ~w~%i", Acessos);
  89.     PlayerTextDrawSetString(playerid, AcessosDii[playerid], string);
  90. }
  91. forward Reset();
  92. public Reset()
  93. {
  94.     gettime(horas, minutos, segundos);
  95.     if(horas == 00 && minutos == 01 && segundos == 0)
  96.     {
  97.         Acessos = 0;
  98.         print("00:01 Horas - Contador de visitas resetados");
  99.     }
  100.     return true;
  101. }
  102. CMD:visitas(playerid)
  103. {
  104.     new str[30];
  105.     format(str, sizeof(str), "Temos no total de %i visitas", Acessos);
  106.     SendClientMessage(playerid, -1, str);
  107.     return 1;
  108. }
  109. CMD:salvarvisitas(playerid)
  110. {
  111.     SalvarVisitas();
  112.     SendClientMessage(playerid, -1, "/INFO/Quantidade de visitas salvas com sucesso.");
  113.     return 1;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement