Advertisement
Guest User

Untitled

a guest
Apr 18th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 12.19 KB | None | 0 0
  1. #include a_samp
  2. #include foreach
  3.  
  4. #define TD_Hide(%0) TextDrawHideForPlayer(%0)
  5. #define TD_Show(%0) TextDrawShowForPlayer(%0)
  6. #define TD_Update(%0) TextDrawSetString(%0)
  7. #define callback->%0(%1) forward %0(%1); public %0(%1)
  8. #define Loop(%0) for(new %0;%0<=MAX_PLAYERS;%0++)
  9.  
  10. new pName[MAX_PLAYERS][MAX_PLAYER_NAME];
  11. new Text:StatyBox[7];
  12. new Text:TD_Nick[MAX_PLAYERS];
  13. new Text:TD_Exp[MAX_PLAYERS];
  14. new Text:TD_Level[MAX_PLAYERS];
  15. new Text:TD_Gang[MAX_PLAYERS];
  16. new Text:TD_Online[MAX_PLAYERS];
  17. new Text:Graczy[MAX_PLAYERS];
  18. new Text:TD_FPS[MAX_PLAYERS];
  19. new Text:TD_Ping[MAX_PLAYERS];
  20. new PlayerText: ID_Skin;
  21. new Administrator[MAX_PLAYERS];
  22. new AdministratorLevel[MAX_PLAYERS];
  23. new Vip[MAX_PLAYERS];
  24. new Players_Online = 0, Admins_Online = 0,Vips_Online = 0;
  25. new p_Hours[MAX_PLAYERS] = 0, p_Minutes[MAX_PLAYERS] = 0, p_Secounds[MAX_PLAYERS] = 0;
  26.  
  27. public OnGameModeInit()
  28. {
  29.     TextDraw();
  30.     TimersInit();
  31. }
  32.  
  33.  
  34. public OnPlayerConnect(playerid)
  35. {
  36.     Players_Online++;
  37.     Vip[playerid] = 0;
  38.     Administrator[playerid] = 0;
  39.     AdministratorLevel[playerid] = 0;
  40.     p_Hours[playerid] = 0;
  41.     p_Minutes[playerid] = 0;
  42.     p_Secounds[playerid] = 0;
  43.     ID_Skin = CreatePlayerTextDraw(playerid, 512.500, 390.500,"_");
  44.     PlayerTextDrawBackgroundColor(playerid, ID_Skin, 0);
  45.     PlayerTextDrawFont(playerid, ID_Skin, TEXT_DRAW_FONT_MODEL_PREVIEW);
  46.     PlayerTextDrawTextSize(playerid, ID_Skin, 100.000, 50.500);
  47.     return 1;
  48. }
  49.  
  50. /*
  51. [...Logowanie...]
  52. if(mysql_num_rows())
  53. {
  54.     new admlvl[MAX_PLAYER_NAME+1];
  55.     GetPlayerName(playerid, admlvl, sizeof(admlvl));
  56.     AdministratorLevel[playerid] = mysql_PlayerGetInt(admlvl, "admin");
  57.     if(AdministratorLevel[playerid] >= 1)
  58.     {
  59.     Admins_Online++;
  60.     Administrator[playerid] = 1;
  61.     }
  62.  
  63.     new vipek[MAX_PLAYER_NAME+1];
  64.     GetPlayerName(playerid, vipek, sizeof(vipek));
  65.     new vipos = mysql_PlayerGetInt(vipek, "ifnull(datediff(vip,now()),'-5')");
  66.     if(vipos >= 0)
  67.     {
  68.     Vips_Online++;
  69.     Vip[playerid] = true;
  70.     }
  71.     [...]
  72. }
  73. */
  74.  
  75. public OnPlayerDisconnect(playerid, reason)
  76. {
  77.     TD_Hide(playerid, StatyBox[0]);
  78.     TD_Hide(playerid, StatyBox[1]);
  79.     TD_Hide(playerid, StatyBox[2]);
  80.     TD_Hide(playerid, StatyBox[3]);
  81.     TD_Hide(playerid, StatyBox[4]);
  82.     TD_Hide(playerid, StatyBox[5]);
  83.     TD_Hide(playerid, StatyBox[6]);
  84.  
  85.     TD_Hide(playerid, TD_Nick[playerid]);
  86.     TD_Hide(playerid, TD_Exp[playerid]);
  87.     TD_Hide(playerid, TD_Level[playerid]);
  88.     TD_Hide(playerid, TD_Gang[playerid]);
  89.     TD_Hide(playerid, TD_Online[playerid]);
  90.     TD_Hide(playerid, Graczy[playerid]);
  91.     TD_Hide(playerid, TD_FPS[playerid]);
  92.     TD_Hide(playerid, TD_Ping[playerid]);
  93.    
  94.     Players_Online--;
  95.    
  96.     if(Administrator[playerid] < 1)
  97.     {
  98.         Admins_Online--;
  99.     }
  100.  
  101.     if(Vip[playerid])
  102.     {
  103.         Vips_Online--;
  104.     }
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerSpawn(playerid)
  109. {
  110.     TD_Show(playerid, StatyBox[0]);
  111.     TD_Show(playerid, StatyBox[1]);
  112.     TD_Show(playerid, StatyBox[2]);
  113.     TD_Show(playerid, StatyBox[3]);
  114.     TD_Show(playerid, StatyBox[4]);
  115.     TD_Show(playerid, StatyBox[5]);
  116.     TD_Show(playerid, StatyBox[6]);
  117.  
  118.     TD_Show(playerid, TD_Nick[playerid]);
  119.     TD_Show(playerid, TD_Exp[playerid]);
  120.     TD_Show(playerid, TD_Level[playerid]);
  121.     TD_Show(playerid, TD_Gang[playerid]);
  122.     TD_Show(playerid, TD_Online[playerid]);
  123.     TD_Show(playerid, Graczy[playerid]);
  124.     TD_Show(playerid, TD_FPS[playerid]);
  125.     TD_Show(playerid, TD_Ping[playerid]);
  126.    
  127.     PlayerTextDrawSetPreviewModel(playerid, ID_Skin, GetPlayerSkin(playerid));
  128.     PlayerTextDrawShow(playerid, ID_Skin);
  129.     return 1;
  130. }
  131.  
  132. public OnPlayerDeath(playerid, killerid, reason)
  133. {
  134.     if(killerid != INVALID_PLAYER_ID)
  135.     {
  136.         if(Vip[killerid])
  137.         {
  138.             SetPlayerScore(killerid, GetPlayerScore(killerid) + 2);
  139.         }
  140.         else
  141.         {
  142.             SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
  143.         }
  144.     }
  145.     SetPlayerScore(playerid, GetPlayerScore(playerid) - 1);
  146.     SendDeathMessage(killerid, playerid, reason);
  147. }
  148.  
  149. forward CheckOnline();
  150. public CheckOnline()
  151. {
  152.     Admins_Online = 0;
  153.     Vips_Online = 0;
  154.     Players_Online = 0;
  155.     Loop(x)
  156.     {
  157.         if(IsPlayerConnected(x))
  158.         {
  159.             Players_Online++;
  160.  
  161.             if(Administrator[x])
  162.             {
  163.                  Admins_Online++;
  164.             }
  165.  
  166.             if(Vip[x])
  167.             {
  168.                 Vips_Online++;
  169.             }
  170.         }
  171.     }
  172. }
  173.  
  174. forward TextDrawUpdate();
  175. public TextDrawUpdate()
  176. {
  177.     new string[256];
  178.     foreach(Player, i)
  179.     {
  180.         p_Secounds[i]++;
  181.         if(p_Secounds[i] >= 60)
  182.         {
  183.             p_Secounds[i] = 0;
  184.             p_Minutes[i]++;
  185.             if(p_Minutes[i] >= 60)
  186.             {
  187.                 p_Minutes[i] = 0;
  188.                 p_Hours[i]++;
  189.             }
  190.         }
  191.     }
  192.     foreach(Player, i)
  193.     {
  194.         if(IsPlayerConnected(i))
  195.         {
  196.  
  197.             format(string, sizeof(string), "(~y~%d~w~)%s", (i), pName[i]);
  198.             TextDrawSetString(TD_Nick[i], string);
  199.             format(string, sizeof(string), "%d", GetPlayerScore(i));
  200.             TextDrawSetString(TD_Exp[i], string);
  201.             format(string, sizeof(string), "%d", GetPlayerLevel(i));
  202.             TextDrawSetString(TD_Level[i], string);
  203.             format(string, sizeof(string), "%d godz %d min %d sek", p_Hours[i], p_Minutes[i], p_Secounds[i]);
  204.             TextDrawSetString(TD_Online[i], string);
  205.             format(string, sizeof(string), "Ping: ~w~%d", GetPlayerPing(i));
  206.             TextDrawSetString(TD_Ping[i], string);
  207.             format(string, sizeof(string), "FPS: ~w~%d", GetPlayerFPS(i));
  208.             TextDrawSetString(TD_FPS[i], string);
  209.             format(string, sizeof(string), "(%d/~y~%d~w~/~r~%d~w~)", Players_Online, Vips_Online, Admins_Online);
  210.             TextDrawSetString(Graczy[i], string);
  211.             format(string, sizeof(string), "%s"/*, ???*/);
  212.             TextDrawSetString(TD_Gang[i], string);
  213.         }
  214.     }
  215.  
  216. }
  217.  
  218. TextDraw()
  219. {
  220.     StatyBox[0] = TextDrawCreate(199.000, 405.500, "LD_POKE:cdback");
  221.     TextDrawFont(StatyBox[0], 4);
  222.     TextDrawTextSize(StatyBox[0], 367.000, 37.000);
  223.     TextDrawColor(StatyBox[0], 799);
  224.  
  225.     StatyBox[1] = TextDrawCreate(223.575424, 399.499938, "Nick");
  226.     TextDrawLetterSize(StatyBox[1], 0.248535, 1.191666);
  227.     TextDrawAlignment(StatyBox[1], 2);
  228.     TextDrawColor(StatyBox[1], -5963521);
  229.     TextDrawSetShadow(StatyBox[1], 0);
  230.     TextDrawSetOutline(StatyBox[1], 1);
  231.     TextDrawBackgroundColor(StatyBox[1], 51);
  232.     TextDrawFont(StatyBox[1], 2);
  233.     TextDrawSetProportional(StatyBox[1], 1);
  234.  
  235.     StatyBox[2] = TextDrawCreate(266.211425, 399.083343, "Respekt");
  236.     TextDrawLetterSize(StatyBox[2], 0.248535, 1.191666);
  237.     TextDrawAlignment(StatyBox[2], 1);
  238.     TextDrawColor(StatyBox[2], -5963521);
  239.     TextDrawSetShadow(StatyBox[2], 0);
  240.     TextDrawSetOutline(StatyBox[2], 1);
  241.     TextDrawBackgroundColor(StatyBox[2], 51);
  242.     TextDrawFont(StatyBox[2], 2);
  243.     TextDrawSetProportional(StatyBox[2], 1);
  244.  
  245.     StatyBox[3] = TextDrawCreate(347.734436, 399.083465, "Level");
  246.     TextDrawLetterSize(StatyBox[3], 0.248535, 1.191666);
  247.     TextDrawAlignment(StatyBox[3], 2);
  248.     TextDrawColor(StatyBox[3], -5963521);
  249.     TextDrawSetShadow(StatyBox[3], 0);
  250.     TextDrawSetOutline(StatyBox[3], 1);
  251.     TextDrawBackgroundColor(StatyBox[3], 51);
  252.     TextDrawFont(StatyBox[3], 2);
  253.     TextDrawSetProportional(StatyBox[3], 1);
  254.  
  255.     StatyBox[4] = TextDrawCreate(410.054565, 399.083312, "Gang");
  256.     TextDrawLetterSize(StatyBox[4], 0.248535, 1.191666);
  257.     TextDrawAlignment(StatyBox[4], 2);
  258.     TextDrawColor(StatyBox[4], -5963521);
  259.     TextDrawSetShadow(StatyBox[4], 0);
  260.     TextDrawSetOutline(StatyBox[4], 1);
  261.     TextDrawBackgroundColor(StatyBox[4], 51);
  262.     TextDrawFont(StatyBox[4], 2);
  263.     TextDrawSetProportional(StatyBox[4], 1);
  264.  
  265.     StatyBox[5] = TextDrawCreate(433.942230, 399.083343, "Czas_Gry");
  266.     TextDrawLetterSize(StatyBox[5], 0.248535, 1.191666);
  267.     TextDrawAlignment(StatyBox[5], 1);
  268.     TextDrawColor(StatyBox[5], -5963521);
  269.     TextDrawSetShadow(StatyBox[5], 0);
  270.     TextDrawSetOutline(StatyBox[5], 1);
  271.     TextDrawBackgroundColor(StatyBox[5], 51);
  272.     TextDrawFont(StatyBox[5], 2);
  273.     TextDrawSetProportional(StatyBox[5], 1);
  274.  
  275.     StatyBox[6] = TextDrawCreate(530.457458, 400.250061, "Online");
  276.     TextDrawLetterSize(StatyBox[6], 0.248535, 1.191666);
  277.     TextDrawAlignment(StatyBox[6], 2);
  278.     TextDrawColor(StatyBox[6], -5963521);
  279.     TextDrawSetShadow(StatyBox[6], 0);
  280.     TextDrawSetOutline(StatyBox[6], 1);
  281.     TextDrawBackgroundColor(StatyBox[6], 51);
  282.     TextDrawFont(StatyBox[6], 2);
  283.     TextDrawSetProportional(StatyBox[6], 1);
  284.  
  285.     Loop(i)
  286.     {
  287.         TD_Nick[i] = TextDrawCreate(231.819824, 420.666748, ".MefiK");
  288.         TextDrawLetterSize(TD_Nick[i], 0.175907, 0.987496);
  289.         TextDrawAlignment(TD_Nick[i], 2);
  290.         TextDrawColor(TD_Nick[i], -1);
  291.         TextDrawSetShadow(TD_Nick[i], 0);
  292.         TextDrawSetOutline(TD_Nick[i], 1);
  293.         TextDrawBackgroundColor(TD_Nick[i], 51);
  294.         TextDrawFont(TD_Nick[i], 1);
  295.         TextDrawSetProportional(TD_Nick[i], 1);
  296.  
  297.         TD_Exp[i] = TextDrawCreate(285.231445, 420.083251, "12345");
  298.         TextDrawLetterSize(TD_Exp[i], 0.175907, 0.987496);
  299.         TextDrawAlignment(TD_Exp[i], 2);
  300.         TextDrawColor(TD_Exp[i], -1);
  301.         TextDrawSetShadow(TD_Exp[i], 0);
  302.         TextDrawSetOutline(TD_Exp[i], 1);
  303.         TextDrawBackgroundColor(TD_Exp[i], 51);
  304.         TextDrawFont(TD_Exp[i], 1);
  305.         TextDrawSetProportional(TD_Exp[i], 1);
  306.  
  307.         TD_Level[i] = TextDrawCreate(343.328399, 420.499847, "11");
  308.         TextDrawLetterSize(TD_Level[i], 0.175907, 0.987496);
  309.         TextDrawAlignment(TD_Level[i], 2);
  310.         TextDrawColor(TD_Level[i], -1);
  311.         TextDrawSetShadow(TD_Level[i], 0);
  312.         TextDrawSetOutline(TD_Level[i], 1);
  313.         TextDrawBackgroundColor(TD_Level[i], 51);
  314.         TextDrawFont(TD_Level[i], 1);
  315.         TextDrawSetProportional(TD_Level[i], 1);
  316.  
  317.         TD_Gang[i] = TextDrawCreate(378.936187, 420.083221, "_Gunwo_Team_");
  318.         TextDrawLetterSize(TD_Gang[i], 0.175907, 0.987496);
  319.         TextDrawAlignment(TD_Gang[i], 1);
  320.         TextDrawColor(TD_Gang[i], -1);
  321.         TextDrawSetShadow(TD_Gang[i], 0);
  322.         TextDrawSetOutline(TD_Gang[i], 1);
  323.         TextDrawBackgroundColor(TD_Gang[i], 51);
  324.         TextDrawFont(TD_Gang[i], 1);
  325.         TextDrawSetProportional(TD_Gang[i], 1);
  326.  
  327.         TD_Online[i] = TextDrawCreate(432.816040, 420.916809, "1000 godz 0 min 0 sek");
  328.         TextDrawLetterSize(TD_Online[i], 0.175907, 0.987496);
  329.         TextDrawAlignment(TD_Online[i], 1);
  330.         TextDrawColor(TD_Online[i], -1);
  331.         TextDrawSetShadow(TD_Online[i], 0);
  332.         TextDrawSetOutline(TD_Online[i], 1);
  333.         TextDrawBackgroundColor(TD_Online[i], 51);
  334.         TextDrawFont(TD_Online[i], 1);
  335.         TextDrawSetProportional(TD_Online[i], 1);
  336.  
  337.         Graczy[i] = TextDrawCreate(526.988891, 420.083221, "(0/~y~0~w~/~r~0~w~)");
  338.         TextDrawLetterSize(Graczy[i], 0.175907, 0.987496);
  339.         TextDrawAlignment(Graczy[i], 2);
  340.         TextDrawColor(Graczy[i], -1);
  341.         TextDrawSetShadow(Graczy[i], 0);
  342.         TextDrawSetOutline(Graczy[i], 1);
  343.         TextDrawBackgroundColor(Graczy[i], 51);
  344.         TextDrawFont(Graczy[i], 1);
  345.         TextDrawSetProportional(Graczy[i], 1);
  346.  
  347.  
  348.         TD_Ping[i] = TextDrawCreate(612.231994, 22.750007, "Ping: ~w~100");
  349.         TextDrawLetterSize(TD_Ping[i], 0.161859, 0.870832);
  350.         TextDrawAlignment(TD_Ping[i], 1);
  351.         TextDrawColor(TD_Ping[i], -5963521);
  352.         TextDrawSetShadow(TD_Ping[i], 0);
  353.         TextDrawSetOutline(TD_Ping[i], 1);
  354.         TextDrawBackgroundColor(TD_Ping[i], 51);
  355.         TextDrawFont(TD_Ping[i], 1);
  356.         TextDrawSetProportional(TD_Ping[i], 1);
  357.  
  358.         TD_FPS[i] = TextDrawCreate(614.105773, 30.916620, "FPS: ~w~100");
  359.         TextDrawLetterSize(TD_FPS[i], 0.161859, 0.870832);
  360.         TextDrawAlignment(TD_FPS[i], 1);
  361.         TextDrawColor(TD_FPS[i], -5963521);
  362.         TextDrawSetShadow(TD_FPS[i], 0);
  363.         TextDrawSetOutline(TD_FPS[i], 1);
  364.         TextDrawBackgroundColor(TD_FPS[i], 51);
  365.         TextDrawFont(TD_FPS[i], 1);
  366.         TextDrawSetProportional(TD_FPS[i], 1);
  367.     }
  368. }
  369.  
  370.  
  371. TimersInit()
  372. {
  373. SetTimer("CheckOnline", 1800, true);
  374. SetTimer("TextDrawUpdate", 1300, true);
  375. }
  376.  
  377. GetPlayerLevel(playerid)
  378. {
  379.         new Lvl;
  380.         do {
  381.             Lvl++;
  382.         } while(Lvl*Lvl*6 < GetPlayerScore(playerid));
  383.         return (Lvl-1 < 1) ? 1 : Lvl-1;
  384. }
  385.  
  386. GetPlayerFPS(playerid)
  387. {
  388.     SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
  389.     if(GetPVarInt(playerid, "DrunkL") < 100) SetPlayerDrunkLevel(playerid, 2000);
  390.     else {
  391.         if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL")) {
  392.             SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
  393.             SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
  394.             if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256)) {
  395.                 return GetPVarInt(playerid, "FPS") - 1;
  396.             }
  397.         }
  398.     }
  399.     return 1;
  400. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement