HIGH CPU usage
#6

You're looping (up to) 15 times per second through 100 players, and that for every player. Remove that .. thing from OnPlayerUpdate.

Here's a really simple fix. 10 seconds should be more than enough.
pawn Code:
// OnGameModeInit
SetTimer("UpdatePlayerCount", 10000, false);

// OnPlayerSpawn
TextDrawShowForPlayer(playerid, players);


// Note that you don't have to re-show the textdraw if it gets updated.
function UpdatePlayerCount();
public UpdatePlayerCount() {
    new
        str[ 10 ];
    format(str, 10, "%d/100", GetOnLinePlayers());
    TextDrawSetString(players, str);
}
Reply


Messages In This Thread
HIGH CPU usage - by Oh - 02.01.2012, 18:42
Re: HIGH CPU usage - by DarkKillerWithPride<3 - 02.01.2012, 18:49
Re: HIGH CPU usage - by Oh - 02.01.2012, 18:52
Re: HIGH CPU usage - by Thunderbolt - 02.01.2012, 19:21
Re: HIGH CPU usage - by Babul - 02.01.2012, 19:25
Re: HIGH CPU usage - by woot - 02.01.2012, 19:27
Re: HIGH CPU usage - by Bakr - 02.01.2012, 19:41
Re: HIGH CPU usage - by Steven82 - 02.01.2012, 19:49
Re: HIGH CPU usage - by Bakr - 02.01.2012, 19:51
Re: HIGH CPU usage - by BlackWolf120 - 02.01.2012, 20:03

Forum Jump:


Users browsing this thread: 2 Guest(s)