Advertisement
EditorRUS

Untitled

Oct 27th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. var/global/list/y_whitelist = list()
  2.  
  3. proc
  4. load_ywhitelist()
  5. y_whitelist = list ()
  6. log_admin("Loading whitelist")
  7. var/DBConnection/dbcon = new()
  8. var/DBQuery/query
  9. dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
  10. if(!dbcon.IsConnected())
  11. log_admin("Failed to load whitelist. Error: [dbcon.ErrorMsg()]")
  12. return 0
  13. query = dbcon.NewQuery("SELECT * FROM whitelist")
  14. query.Execute()
  15. while (query.NextRow())
  16. y_whitelist += "[query.item[1]]"
  17. dbcon.Disconnect()
  18. log_admin("Whitelist init complete. There's [y_whitelist.len] in whitelist")
  19. return 1
  20.  
  21. isInWhitelist(var/K)
  22. K = ckey(K)
  23. if (K in y_whitelist)
  24. return 1
  25. return 0
  26.  
  27. /datum/admins/proc
  28. LoadWhitelist()
  29. set category = "Server"
  30. set name = "Update whitelist"
  31.  
  32. if (load_ywhitelist())
  33. usr << "\blue \bold Success!"
  34. else
  35. usr << "\red \bold Fail!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement