Guest User

Frames Calculator

a guest
Aug 30th, 2010
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.92 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new
  4.     Text: textFPS[MAX_PLAYERS]
  5. ;
  6.  
  7. public OnFilterScriptInit()
  8. {
  9.     for(new i; i != GetMaxPlayers(); ++i)
  10.     {
  11.         textFPS[i] = TextDrawCreate(636.000000, 2.000000, " ");
  12.         TextDrawAlignment(textFPS[i], 3);
  13.         TextDrawBackgroundColor(textFPS[i], 50);
  14.         TextDrawFont(textFPS[i], 2);
  15.         TextDrawLetterSize(textFPS[i], 0.240000, 1.500000);
  16.         TextDrawColor(textFPS[i], -65281);
  17.         TextDrawSetOutline(textFPS[i], 1);
  18.         TextDrawSetProportional(textFPS[i], 1);
  19.     }
  20.     SetTimer("fpsCheck", 100, true);
  21.     return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26.     for(new i; i != GetMaxPlayers(); ++i)
  27.     {
  28.         TextDrawDestroy(textFPS[i]);
  29.     }
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerSpawn(playerid)
  34. {
  35.     SetPVarInt(playerid, "spawned", true);
  36.     return 1;
  37. }
  38.  
  39. public OnPlayerDeath(playerid, killerid)
  40. {
  41.     SetPVarInt(playerid, "spawned", false);
  42.     return 1;
  43. }
  44.  
  45. forward fpsCheck();
  46. public fpsCheck()
  47. {
  48.     for(new i; i != GetMaxPlayers(); ++i)
  49.     {
  50.         if(IsPlayerConnected(i) && !IsPlayerNPC(i))
  51.         {
  52.             if(GetPVarInt(i, "spawned"))
  53.             {
  54.                 SetPVarInt(i, "drunkLevel", GetPlayerDrunkLevel(i));
  55.  
  56.                 if(GetPVarInt(i, "drunkLevel") < 100)
  57.                 {
  58.                     SetPlayerDrunkLevel(i, 2000);
  59.                 }
  60.                 else
  61.                 {
  62.                     if(GetPVarInt(i, "lastDrunkLevel") != GetPVarInt(i, "drunkLevel"))
  63.                     {
  64.                         SetPVarInt(i, "fps", (GetPVarInt(i, "lastDrunkLevel") - GetPVarInt(i, "drunkLevel")));
  65.                         SetPVarInt(i, "lastDrunkLevel", GetPVarInt(i, "drunkLevel"));
  66.                        
  67.                         if((GetPVarInt(i, "fps") > 0) && (GetPVarInt(i, "fps") < 256))
  68.                         {
  69.                             new
  70.                                 string[6]
  71.                             ;
  72.                             format(string, sizeof(string), "%d", GetPVarInt(i, "fps") - 1);
  73.                             TextDrawSetString(textFPS[i], string);
  74.                             TextDrawShowForPlayer(i, textFPS[i]);
  75.                         }
  76.                     }
  77.                 }
  78.             }
  79.             else
  80.             {
  81.                 TextDrawHideForPlayer(i, textFPS[i]);
  82.             }
  83.         }
  84.     }
  85.     return 1;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment