Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. import sqlite3
  2.  
  3. import es
  4.  
  5. db = '/home/cstrike/Website/cattes/cattes.db'
  6.  
  7. def load():
  8.     if not es.exists('clientcommand', 'cattes_auth'):
  9.         es.regclientcmd('cattes_auth', 'auth/auth_player', 'Authorizes you. Duh.')
  10.  
  11. def unload():
  12.     if es.exists('clientcommand', 'cattes_auth'):
  13.         es.unregclientcmd('cattes_auth')
  14.  
  15. def auth_player():
  16.     userid = es.getcmduserid()
  17.     steamid = es.getplayersteamid(userid)
  18.     authCode = es.getargv(1)
  19.     steamgay = "".join(steamid)
  20.     conn = sqlite3.connect(db)
  21.     curs = conn.cursor()
  22.     curs2 = conn.cursor()
  23.     curs.execute("SELECT authcode FROM auth_cattesuser WHERE steam_id = ?", steamgay)
  24.     if authCode == curs:
  25.         es.cexec(userid,"echo You are now registered! Congrats!")
  26.         curs2.execute("UPDATE auth_cattesuser SET access_level=1 WHERE steam_id = ?", steamgay)
  27.     else:
  28.         es.cexec(userid,"echo Not a valid code. Please try again.")
  29.     conn.commit()
  30.     curs.close()
  31.     curs2.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement