#include <a_samp>
// 3D Info 1.1 by O.K.Style™
new PlayerText3D:Info[MAX_PLAYERS];
public OnPlayerStreamIn(playerid, forplayerid)
{
if(!IsPlayerAdmin(forplayerid)) return 1;
if(IsPlayerAdmin(playerid)) return 1;
if(IsPlayerNPC(playerid)) return 1;
Info[playerid] = CreatePlayer3DTextLabel(forplayerid, "Health: 0.0\nArmour: 0.0\nPing: 0\nFPS: 0\nMoney: 0", -1, 0.0, 0.0, 0.35, 30.0, playerid, INVALID_VEHICLE_ID, 0);
return 1;
}
public OnPlayerUpdate(playerid)
{
new Float:HP,Float:AP;
GetPlayerHealth(playerid, HP);
GetPlayerArmour(playerid, AP);
new string_3D[256];
format(string_3D, sizeof(string_3D), "{FFFFFF}Health: {FDE39D}%.0f\n{FFFFFF}Armour: {FDE39D}%.0f\n{FFFFFF}Ping: {FDE39D}%d\n{FFFFFF}FPS: {FDE39D}%d\n{FFFFFF}Money: {FDE39D}%d", HP, AP, GetPlayerPing(playerid), GetPlayerFPS(playerid), GetPlayerMoney(playerid));
for(new i, j = GetMaxPlayers(); i != j; i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerNPC(i)) continue;
if(!IsPlayerAdmin(i)) continue;
if(IsPlayerAdmin(playerid)) continue;
UpdatePlayer3DTextLabelText(i, Info[playerid], -1, string_3D);
}
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
if(IsPlayerNPC(playerid)) return 1;
if(!IsPlayerAdmin(forplayerid)) return 1;
if(IsPlayerAdmin(playerid)) return 1;
for(new i; i < 6; i++) DeletePlayer3DTextLabel(forplayerid, Info[playerid]);
return 1;
}
stock GetPlayerFPS(playerid)
{
SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
if(GetPVarInt(playerid, "DrunkL") < 100) SetPlayerDrunkLevel(playerid, 2000);
else
{
if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
{
SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256)) return GetPVarInt(playerid, "FPS") - 1;
}
}
return 0;
}
I can't understand why are you setting the player's drunk level to 2000 in the stock of GetPlayerFPS.
|
This is the way of getting FPS by JerneiL.
About loop: I find it easier to insert checks into the OnPlayerUpdate than creating unnecessary extra for this timer |
Why are you creating 5 3D labels? You can make lines using "\n" when you format the string!
|