OKStyle

3D Info

Oct 12th, 2011
891
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. // 3D Info by O.K.Style™
  3. new PlayerText3D:Info[MAX_PLAYERS][5];
  4. new
  5.     string_3D1[50],
  6.     string_3D2[50],
  7.     string_3D3[50],
  8.     string_3D4[50],
  9.     string_3D5[50]
  10. ;
  11. new Float:HP,Float:AP;
  12. public OnPlayerStreamIn(playerid, forplayerid)
  13. {
  14.     if(!IsPlayerAdmin(forplayerid)) return 1;
  15.     if(IsPlayerAdmin(playerid)) return 1;
  16.     if(IsPlayerNPC(playerid)) return 1;
  17.     Info[playerid][0] = CreatePlayer3DTextLabel(forplayerid, "Health: 0.0", -1, 0.0, 0.0, 0.35, 30.0, playerid, INVALID_VEHICLE_ID, 0);
  18.     Info[playerid][1] = CreatePlayer3DTextLabel(forplayerid, "Armour: 0.0", -1, 0.0, 0.0, 0.30, 30.0, playerid, INVALID_VEHICLE_ID, 0);
  19.     Info[playerid][2] = CreatePlayer3DTextLabel(forplayerid, "Ping: 0", -1, 0.0, 0.0, 0.25, 30.0, playerid, INVALID_VEHICLE_ID, 0);
  20.     Info[playerid][3] = CreatePlayer3DTextLabel(forplayerid, "FPS: 0", -1, 0.0, 0.0, 0.20, 30.0, playerid, INVALID_VEHICLE_ID, 0);
  21.     Info[playerid][4] = CreatePlayer3DTextLabel(forplayerid, "Money: 0", -1, 0.0, 0.0, 0.15, 30.0, playerid, INVALID_VEHICLE_ID, 0);
  22.     return 1;
  23. }
  24. public OnPlayerUpdate(playerid)
  25. {
  26.     GetPlayerHealth(playerid, HP);
  27.     GetPlayerArmour(playerid, AP);
  28.     format(string_3D1, sizeof(string_3D1), "{FFFFFF}Health: {FDE39D}%.0f", HP);
  29.     format(string_3D2, sizeof(string_3D2), "{FFFFFF}Armour: {FDE39D}%.0f", AP);
  30.     format(string_3D3, sizeof(string_3D3), "{FFFFFF}Ping: {FDE39D}%d", GetPlayerPing(playerid));
  31.     format(string_3D4, sizeof(string_3D4), "{FFFFFF}FPS: {FDE39D}%d", GetPlayerFPS(playerid));
  32.     format(string_3D5, sizeof(string_3D5), "{FFFFFF}Money: {FDE39D}%d", GetPlayerMoney(playerid));
  33.     for(new i, j = GetMaxPlayers(); i != j; i++)
  34.     {
  35.         if(!IsPlayerConnected(i)) continue;
  36.         if(IsPlayerNPC(i)) continue;
  37.         if(!IsPlayerAdmin(i)) continue;
  38.         if(IsPlayerAdmin(playerid)) continue;
  39.         UpdatePlayer3DTextLabelText(i, Info[playerid][0], -1, string_3D1);
  40.         UpdatePlayer3DTextLabelText(i, Info[playerid][1], -1, string_3D2);
  41.         UpdatePlayer3DTextLabelText(i, Info[playerid][2], -1, string_3D3);
  42.         UpdatePlayer3DTextLabelText(i, Info[playerid][3], -1, string_3D4);
  43.         UpdatePlayer3DTextLabelText(i, Info[playerid][4], -1, string_3D5);
  44.     }
  45.     return 1;
  46. }
  47. public OnPlayerStreamOut(playerid, forplayerid)
  48. {
  49.     if(IsPlayerNPC(playerid)) return 1;
  50.     if(!IsPlayerAdmin(forplayerid)) return 1;
  51.     if(IsPlayerAdmin(playerid)) return 1;
  52.     for(new i; i < 6; i++) DeletePlayer3DTextLabel(forplayerid, Info[playerid][i]);
  53.     return 1;
  54. }
  55. stock GetPlayerFPS(playerid)
  56. {
  57.     SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
  58.     if(GetPVarInt(playerid, "DrunkL") < 100) SetPlayerDrunkLevel(playerid, 2000);
  59.     else
  60.     {
  61.         if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
  62.         {
  63.             SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
  64.             SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
  65.             if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256)) return GetPVarInt(playerid, "FPS") - 1;
  66.         }
  67.     }
  68.     return 0;
  69. }
RAW Paste Data