PDA

View Full Version : GetPlayerFps prob..


Steezy_
03/08/2013, 04:24 PM
Hey guys, i find out on the samp forum this script of player's fps.. but it doesn't work, could someone help me?
The prob is that it shows always 0.. maybe sometimes it get real fps for 20-30 milleseconds.. and then get back to 0

This is the code..
public OnPlayerUpdate(playerid)
{
new string[20];
format(string, sizeof(string), "FPS: %d", GetPlayerFPS(playerid));
TextDrawSetString(qw, string);
}

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;
}

And this the textdraw
qw = TextDrawCreate(500.000000, 3.000000, "FPS:");
TextDrawBackgroundColor(qw, 255);
TextDrawFont(qw, 1);
TextDrawLetterSize(qw, 0.300000, 0.899999);
TextDrawColor(qw, -1728052993);
TextDrawSetOutline(qw, 0);
TextDrawSetProportional(qw, 1);
TextDrawSetShadow(qw, 1);
TextDrawSetSelectable(qw, 0);
Thanks..