Advertisement
yojimbos_law

function for logging online players

Dec 8th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. void log_online_players(){
  2. //every 5 minutes.
  3. if(max(gametime_to_int() - get_property("_last_online_check").to_int(),get_property("_last_online_check").to_int() - gametime_to_int()) > 300000){
  4. string[int] online_players;
  5. file_to_map("online players.txt",online_players);
  6. set_property("message_index",get_property("message_index").to_int()+1);
  7. online_players[get_property("message_index").to_int()] = group_string(visit_url("login.php"), "There are currently.*?<b>(\\d+)</b>")[0][1].to_int()+" players logged in at "+gametime_to_int()+" on "+today_to_string();
  8. print(online_players[get_property("message_index").to_int()]);
  9. map_to_file(online_players, "online players.txt");
  10. set_property("_last_online_check",gametime_to_int());
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement