LucasViniciusLV

[CODE] PacketLoss and FPS

Jul 8th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.92 KB | None | 0 0
  1. stock Float:GetPlayerPacketLoss(playerid) {
  2.     new stats[401], stringstats[70];
  3.     GetPlayerNetworkStats(playerid, stats, sizeof(stats));
  4.     new len = strfind(stats, "Packetloss: ");
  5.     new Float:packetloss = 0.0;
  6.     if(len != -1) {
  7.         strmid(stringstats, stats, len, strlen(stats));
  8.         new len2 = strfind(stringstats, "%");
  9.         if(len != -1) {
  10.             strdel(stats, 0, strlen(stats));
  11.             strmid(stats, stringstats, len2-3, len2);
  12.             packetloss = floatstr(stats);
  13.             }
  14.     }
  15.     return packetloss;
  16. }
  17.  
  18.  
  19. stock GetPlayerFPS(playerid) {
  20.     new drunk2 = GetPlayerDrunkLevel(playerid);
  21.     if(drunk2 < 100){
  22.         SetPlayerDrunkLevel(playerid,2000);
  23.     }else{
  24.         if(Player[playerid][DLlast] != drunk2){
  25.             new fps = Player[playerid][DLlast] - drunk2;
  26.             if((fps > 0) && (fps < 200))
  27.             Player[playerid][FPS] = fps;
  28.             Player[playerid][DLlast] = drunk2;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment