Advertisement
Guest User

[FS] Rekordo sistema su saugojimu bei krovimu

a guest
Aug 17th, 2013
1,019
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.09 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3.  
  4. #define FILTERSCRIPT
  5. #define Failas "Rekordas.ini"
  6.  
  7. new
  8.     pRekordas
  9. ;
  10.  
  11. #if defined FILTERSCRIPT
  12. public OnFilterScriptInit()
  13. {
  14.     if(!fexist(Failas))
  15.     {
  16.         dini_Create(Failas);
  17.         pRekordas = 0;
  18.     }
  19.     else
  20.     {
  21.         pRekordas = dini_Int(Failas, "Rekord");
  22.     }
  23.     return true;
  24. }
  25. #endif
  26. public OnPlayerConnect(playerid)
  27. {
  28.     if(GetOnlinePlayers() > pRekordas)
  29.     {
  30.         new
  31.             msg[128]
  32.         ;
  33.         format(msg, sizeof(msg), "Pasiektas naujas žaidėjų rekordas: {FF0000}%i {00FF00}Senas rekordas: {FF0000}%i", GetOnlinePlayers(), pRekordas);
  34.         SendClientMessageToAll(0x00FF00FF, msg);
  35.         pRekordas = GetOnlinePlayers();
  36.         dini_IntSet(Failas, "Rekord", pRekordas);
  37.     }
  38.     return true;
  39. }
  40.  
  41. public OnPlayerDisconnect(playerid, reason)
  42. {
  43.     return true;
  44. }
  45. stock GetOnlinePlayers()
  46. {
  47.     new
  48.         Online
  49.     ;
  50.     for(new i = 0; i < MAX_PLAYERS; i++)
  51.     {
  52.         if(IsPlayerConnected(i))
  53.         {
  54.             Online ++;
  55.         }
  56.     }
  57.     return Online;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement