Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new fpsON[MAX_PLAYERS];
- new TimerFPS;
- new pDrunkLevelLast[MAX_PLAYERS];
- new pFPS[MAX_PLAYERS];
- new Text:FPS[MAX_PLAYERS];
- forward RefreshFPS(playerid);
- public OnFilterScriptInit()
- {
- print("In-Game FPS by SkillNasr");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- /* Crea la TextDraw */
- FPS[playerid] = TextDrawCreate(596.000000, 0.000000, "_");
- TextDrawBackgroundColor(FPS[playerid], 255);
- TextDrawFont(FPS[playerid], 3);
- TextDrawLetterSize(FPS[playerid], 0.669999, 1.900000);
- TextDrawColor(FPS[playerid], -65281);
- TextDrawSetOutline(FPS[playerid], 0);
- TextDrawSetProportional(FPS[playerid], 1);
- TextDrawSetShadow(FPS[playerid], 1);
- fpsON[playerid] = 0;
- /**/
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- fpsON[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp(cmdtext, "/fps", true))
- {
- if(fpsON[playerid] == 0)
- {
- PlayerPlaySound(playerid,1054,0.0,0.0,0.0),
- TimerFPS = SetTimerEx("RefreshFPS", 3000, true, "i",playerid);
- fpsON[playerid] = 1;
- }
- else if(fpsON[playerid] == 1)
- {
- PlayerPlaySound(playerid,1054,0.0,0.0,0.0),
- KillTimer(TimerFPS);
- fpsON[playerid] = 0;
- TextDrawHideForPlayer(playerid, FPS[playerid]);
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- new drunknew;
- drunknew = GetPlayerDrunkLevel(playerid);
- if (drunknew < 100) {
- SetPlayerDrunkLevel(playerid, 2000);
- } else {
- if (pDrunkLevelLast[playerid] != drunknew) {
- new wfps = pDrunkLevelLast[playerid] - drunknew;
- if ((wfps > 0) && (wfps < 200))
- pFPS[playerid] = wfps;
- pDrunkLevelLast[playerid] = drunknew;
- }
- }
- return 1;
- }
- public RefreshFPS(playerid)
- {
- new string[128];
- format(string, sizeof(string), "%i",pFPS[playerid]);
- TextDrawSetString(FPS[playerid], string);
- TextDrawShowForPlayer(playerid, FPS[playerid]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement