even better leaving
This commit is contained in:
parent
d0e89672a9
commit
965c2910e9
12
src/app.py
12
src/app.py
|
@ -245,21 +245,13 @@ def on_leave(data):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
if data["username"] in games[room]["players"].keys():
|
if data["username"] not in games[room]["players"].keys():
|
||||||
return # you have been kicked
|
return # you have been kicked
|
||||||
if dohash(data["_gid"]) == room:
|
if dohash(data["_gid"]) == room:
|
||||||
pass
|
pass
|
||||||
elif games[room]["players"][data["username"]][1] != data['_gid']:
|
elif games[room]["players"][data["username"]][1] != data['_gid']:
|
||||||
return
|
return
|
||||||
username = ""
|
username = data['username']
|
||||||
if "username" in data.keys():
|
|
||||||
username = data['username']
|
|
||||||
else:
|
|
||||||
gid = data["_gid"]
|
|
||||||
if dohash(gid) == room:
|
|
||||||
leave_room(str(room))
|
|
||||||
emit('host_leave_event', {'host': 0}, room=room)
|
|
||||||
return
|
|
||||||
del games[room]["players"][username]
|
del games[room]["players"][username]
|
||||||
leave_room(str(room))
|
leave_room(str(room))
|
||||||
emit('player_leave_event', {"player": username}, room=room)
|
emit('player_leave_event', {"player": username}, room=room)
|
||||||
|
|
Reference in New Issue
Block a user