09.06.2011, 09:26
Hi guys,i've created a textdraw to show my FPS but i've got a problem.
The Textdraw shows only: Your FPS: 0.
Here is the code:
new Text:FPSTD;
OnGameModeInit
OnPlayerConnect
The stock:
Thanks.
The Textdraw shows only: Your FPS: 0.
Here is the code:
new Text:FPSTD;
OnGameModeInit
pawn Код:
FPSTD = TextDrawCreate(500.000000, 101.000000, "Your FPS:");
TextDrawBackgroundColor(FPSTD, 255);
TextDrawFont(FPSTD, 1);
TextDrawLetterSize(FPSTD, 0.449999, 1.799999);
TextDrawColor(FPSTD, -16776961);
TextDrawSetOutline(FPSTD, 1);
TextDrawSetProportional(FPSTD, 1);
pawn Код:
new newtext[128];
format(newtext, sizeof(newtext), "Your FPS: %d", GetPlayerFPS(playerid));
TextDrawSetString(FPSTD, newtext);
TextDrawShowForPlayer(playerid, FPSTD);
pawn Код:
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;
}