Advertisement
Guest User

Untitled

a guest
Jun 27th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. --[[
  2. Resource: OURGame v2
  3. Developers: Split <split.programista@gmail.com>
  4. You have no right to use this code without my permission.
  5. (c) 2015 <split.programista@gmail.com>. All rights reserved.
  6. ]]
  7.  
  8. -- Settings
  9. DBHandler=nil
  10. DBName=""
  11. DBUser=""
  12. DBPass=""
  13. DBHost=""
  14.  
  15. -- Functions
  16. function dbSet(...)
  17. if not {...} then return end
  18. local qh = dbQuery(DBHandler, ...)
  19. if not qh then return false end
  20. local result, num_affected_rows, last_insert_id = dbPoll(qh, -1)
  21. return result, num_affected_rows, last_insert_id
  22. end
  23.  
  24. function dbGet(...)
  25. if not {...} then return end
  26. local stringe=dbPrepareString(DBHandler,...)
  27. local query=dbQuery(DBHandler, stringe)
  28. local result,num_affected_rows, last_insert_id =dbPoll(query, -1)
  29. return result
  30. end
  31.  
  32.  
  33. addEventHandler("onResourceStart", resourceRoot, function()
  34. DBHandler=dbConnect("mysql", "dbname="..DBName..";host="..DBHost.."", DBUser, DBPass, "share=1;autoreconnect=1")
  35. if DBHandler then
  36. outputDebugString("* Połączono pomyślnie! (MySQL)")
  37. dbSet("SET NAMES utf8")
  38. else
  39. outputDebugString("* Brak połączenia! (MySQL)")
  40. end
  41. end)
  42.  
  43.  
  44.  
  45.  
  46.  
  47. function pobierzTabeleWynikow(...)
  48. local h=dbQuery(DBHandler,...)
  49. if (not h) then
  50. return nil
  51. end
  52. local rows = dbPoll(h, -1)
  53. return rows
  54. end
  55.  
  56. function pobierzWyniki(...)
  57. local h=dbQuery(DBHandler,...)
  58. if (not h) then
  59. return nil
  60. end
  61. local rows = dbPoll(h, -1)
  62. if not rows then return nil end
  63. return rows[1]
  64. end
  65.  
  66. function zapytanie(...)
  67. local h=dbQuery(DBHandler,...)
  68. local result,numrows=dbPoll(h,-1)
  69. return numrows
  70. end
  71.  
  72. --[[
  73. function insertID()
  74. return mysql_insert_id(SQL)
  75. end
  76. function affectedRows()
  77. return mysql_affected_rows(SQL)
  78. end
  79. ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement