Last active
August 29, 2015 14:10
-
-
Save ornicar/82d1c0d0417f6ca70e4f to your computer and use it in GitHub Desktop.
lol found in gameknot.js homepage: fake changing number of players
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total_players_online = 1903; | |
var current_players_online; | |
function update_players_online() | |
{ | |
if (!current_players_online) current_players_online = total_players_online; | |
var th = 0.4 + ( current_players_online - total_players_online ) / 200; | |
if (th<0) th=0; | |
if (th>1) th=1; | |
if (Math.random()>0.7) | |
{ | |
current_players_online += th<Math.random() ? 1 : -1; | |
if (current_players_online<100) current_players_online = 100; | |
} | |
var o = gk_get_el( 'count-players-online' ); | |
if (o) o.innerHTML = comma_num(current_players_online); | |
} | |
setInterval( update_players_online, 300 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment