Advertisement
Guest User

Ping/FPS Labels

a guest
Apr 23rd, 2014
3,409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.20 KB | None | 0 0
  1. #include <a_samp>
  2. #include <YSI\y_timers>
  3.  
  4. new pDrunkLevelLast[MAX_PLAYERS];
  5. new pFPS[MAX_PLAYERS];
  6. new Text3D:PlayerLabel[MAX_PLAYERS];
  7.  
  8. public OnPlayerConnect(playerid)
  9. {
  10.     pDrunkLevelLast[playerid] = 0;
  11.     pFPS[playerid] = 0;
  12.     PlayerLabel[playerid] = Create3DTextLabel("_", 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
  13.     Attach3DTextLabelToPlayer(PlayerLabel[playerid], playerid, 0.0, 0.0, 0.75);
  14. }
  15.  
  16. public OnPlayerDisconnect(playerid)
  17. {
  18.     Delete3DTextLabel(PlayerLabel[playerid]);
  19.     return 1;
  20. }
  21.  
  22. ptask asdasd[1000](playerid)
  23. {
  24.     new drunknew;
  25.     drunknew = GetPlayerDrunkLevel(playerid);
  26.  
  27.     if (drunknew < 100)
  28.     {
  29.         SetPlayerDrunkLevel(playerid, 2000);
  30.     }
  31.     else
  32.     {
  33.         if (pDrunkLevelLast[playerid] != drunknew)
  34.         {
  35.             new wfps = pDrunkLevelLast[playerid] - drunknew;
  36.             if ((wfps > 0) && (wfps < 200))
  37.                 pFPS[playerid] = wfps;
  38.             pDrunkLevelLast[playerid] = drunknew;
  39.         }
  40.     }
  41.  
  42.     //FPS/Ping
  43.     static tmp[128];
  44.     format(tmp, sizeof(tmp), "{FFFF00}FPS: {FF0000}%i\n{FFFF00}Ping: {FF0000}%i", pFPS[playerid], GetPlayerPing(playerid));
  45.     Update3DTextLabelText(PlayerLabel[playerid], 0xFFFFFFFF, tmp);
  46.     return 1;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement