Search This Blog

Monday, March 27, 2017

A who is online notifier.

So I know that people have other things to do other than playing on Minecraft all the time.
So wouldn't it be cool to know if someone is online or not by a computer beep instead of opening the game and checking?
Here is a simple 'beep' function when someone gets on the pycraft server.
1. You will need to put the PyCraft Server IP in the IP part of this script.
2. you need a security key from support@homeschoolhackers.org to run it.


#Check for ppl on the server.
from mc import *
import winsound
import time
mc=Minecraft.create('PYCRAFT_IP')

while True:
    try:
        ctime1= time.ctime()
        EID = mc.getPlayerEntityIds()#returns list [788195]
        print(ctime1,EID)
        Freq = 2500 # Set Frequency To 2500 Hertz
        Dur = 1000 # Set Duration To 1000 ms == 1 second
        winsound.Beep(Freq,Dur)
        time.sleep(20)
    except:
        time.sleep(60)
        ctime1= time.ctime()
        print(ctime1+'-No one is on')
        continue

No comments:

Post a Comment