Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. -- Data : Name : Ati , 2017.06.21, 0:18
  2.  
  3. local dbName = "test"
  4. local host = "localhost"
  5. local username = "root"
  6. local password = ""
  7. local dbConnection = dbConnect( "mysql", "dbname="..dbName..";host="..host, username, password)
  8. local contact = {{}}
  9. local picsa = contact
  10. function create_marker(player,commandName,types,x,y,z)
  11. local types = tonumber(types)
  12. if types then
  13. outputChatBox("Lerakva")
  14. local Px,Py,Pz = getElementPosition(player)
  15. local find_table = dbQuery( dbConnection, "SELECT * FROM interior" )
  16. local hit = dbPoll( find_table, -1 )
  17.  
  18. if hit then
  19.  
  20. local set_marker_data = dbExec(dbConnection, "INSERT INTO interior SET x = ?, y = ?, z = ?, type = ?", Px, Py, Pz, types)
  21.  
  22. end
  23. else
  24.  
  25. outputChatBox("/add_interior [típus]")
  26. end
  27.  
  28.  
  29. end
  30. addCommandHandler("add_interior",create_marker)
  31. -- function name ()
  32.  
  33. -- local find_table = dbQuery( dbConnection, "SELECT * FROM interior" )
  34. -- local hit = dbPoll( find_table, -1 )
  35.  
  36.  
  37. -- end
  38.  
  39. function get_marker(player,commandName,x,y,z)
  40.  
  41. local find_table = dbQuery( dbConnection, "SELECT * FROM interior" )
  42. local hit = dbPoll( find_table, -1 )
  43. local X,Y,Z,ID,T
  44.  
  45. if hit then
  46.  
  47.  
  48. for k,v in pairs(hit) do
  49. --local get_marker_data = dbExec(dbConnection,"SELECT * FROM interior WHERE x=?", x )
  50. if v["x"] and v["y"] and v["z"] and v["id"] and v["type"]then
  51. ID = v["id"]
  52. X = v["x"]
  53. Y = v["y"]
  54. Z = v["z"]
  55. T = v["type"]
  56. -- outputChatBox(ID..": "..X..","..Y..","..Z)
  57. end
  58.  
  59. contact[k] = createMarker(X,Y,Z, "cylinder", 1,244,20,20,140)
  60.  
  61. end
  62.  
  63.  
  64. end
  65.  
  66.  
  67. end
  68. addCommandHandler("get_I",get_marker)
  69.  
  70. function remove_interior(player,commandName,ID)
  71. local find_table = dbQuery( dbConnection, "SELECT * FROM interior " )
  72. local hit = dbPoll( find_table, -1 )
  73. local ID = tonumber(ID)
  74. if ID then
  75. for k,v in pairs(hit) do
  76. if ID == v["id"] then
  77. remove_int = dbExec(dbConnection,"DELETE FROM interior WHERE id = '"..ID.."'")
  78. end
  79. end
  80. else
  81. outputChatBox("/remove_I [ID]")
  82. end
  83. end
  84. addCommandHandler("remove_I", remove_interior)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement