summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDico200 <dico.karssiens@gmail.com>2015-11-01 21:59:05 +0100
committerDico200 <dico.karssiens@gmail.com>2015-11-01 21:59:05 +0100
commit5f77eddf5c95b3ff38b8aaa56e1c019daeb1edc0 (patch)
tree0a0aa6d16aada664af84644f9cf39050fa4bd841
parent085360c331ec58b6eddd23e71cb8dca2dff86854 (diff)
This module should work now. Can someone test it?
-rw-r--r--synchronizeranks.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/synchronizeranks.py b/synchronizeranks.py
index 97439e0..56cc20b 100644
--- a/synchronizeranks.py
+++ b/synchronizeranks.py
@@ -27,19 +27,19 @@ def on_player_join(event):
if role != ranks[rank]:
set_role(uuid, ranks[rank])
return
- if not user.hasPlayedBefore():
- return
- if role == None:
+ if user.hasPlayedBefore() and role == None:
msg(user, "&cYou haven't registed yet! Make sure to do so on redstoner.com")
-
def get_role(uuid):
- return execute_query("SELECT `role_id` FROM users WHERE `uuid` = ? LIMIT 1", uuid)[0][17]
+ results = execute_query("SELECT `role_id` FROM users WHERE `uuid` = ? LIMIT 1", uuid)
+ return results[0][0]
+ # Returns a table with 1 row (LIMIT 1) and 1 column (SELECT `role_id`), so we're looking for the first row of the first column.
def set_role(uuid, role_id):
- execute_update("UPDATE users SET `role_id` = %d WHERE `uuid` = ?" % role_id, uuid)
+ execute_update(("UPDATE users SET `role_id` = %d WHERE `uuid` = ?" % role_id), uuid)
+ # %d is like %s for integers (unlogically, you'd expect something like %i), though %s also works here.
def execute_query(query, uuid):