Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new
- Text: textFPS[MAX_PLAYERS]
- ;
- public OnFilterScriptInit()
- {
- for(new i; i != GetMaxPlayers(); ++i)
- {
- textFPS[i] = TextDrawCreate(636.000000, 2.000000, " ");
- TextDrawAlignment(textFPS[i], 3);
- TextDrawBackgroundColor(textFPS[i], 50);
- TextDrawFont(textFPS[i], 2);
- TextDrawLetterSize(textFPS[i], 0.240000, 1.500000);
- TextDrawColor(textFPS[i], -65281);
- TextDrawSetOutline(textFPS[i], 1);
- TextDrawSetProportional(textFPS[i], 1);
- }
- SetTimer("fpsCheck", 100, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i; i != GetMaxPlayers(); ++i)
- {
- TextDrawDestroy(textFPS[i]);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPVarInt(playerid, "spawned", true);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid)
- {
- SetPVarInt(playerid, "spawned", false);
- return 1;
- }
- forward fpsCheck();
- public fpsCheck()
- {
- for(new i; i != GetMaxPlayers(); ++i)
- {
- if(IsPlayerConnected(i) && !IsPlayerNPC(i))
- {
- if(GetPVarInt(i, "spawned"))
- {
- SetPVarInt(i, "drunkLevel", GetPlayerDrunkLevel(i));
- if(GetPVarInt(i, "drunkLevel") < 100)
- {
- SetPlayerDrunkLevel(i, 2000);
- }
- else
- {
- if(GetPVarInt(i, "lastDrunkLevel") != GetPVarInt(i, "drunkLevel"))
- {
- SetPVarInt(i, "fps", (GetPVarInt(i, "lastDrunkLevel") - GetPVarInt(i, "drunkLevel")));
- SetPVarInt(i, "lastDrunkLevel", GetPVarInt(i, "drunkLevel"));
- if((GetPVarInt(i, "fps") > 0) && (GetPVarInt(i, "fps") < 256))
- {
- new
- string[6]
- ;
- format(string, sizeof(string), "%d", GetPVarInt(i, "fps") - 1);
- TextDrawSetString(textFPS[i], string);
- TextDrawShowForPlayer(i, textFPS[i]);
- }
- }
- }
- }
- else
- {
- TextDrawHideForPlayer(i, textFPS[i]);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment