Advertisement
Noneatme

Untitled

Dec 3rd, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.34 KB | None | 0 0
  1.  
  2.  
  3. sSetting["aviableDatas"] = {
  4.     ["id"] = "Playerid",
  5.     ["lastx"] = "Lastx",
  6.     ["lasty"] = "Lasty",
  7.     ["lastz"] = "Lastz",
  8.     ["lastint"] = "Lastint",
  9.     ["tode"] = "Tode",
  10.     ["morde"] = "Morde",
  11.     ["flashlight"] = "Flashlight",
  12.     ["mission"] = "Mission",
  13.     ["weapons"] = "Weapons",
  14.     ["carx"] = "Carx",
  15.     ["cary"] = "Cary",
  16.     ["carz"] = "Carz",
  17.     ["carrx"] = "Carrx",
  18.     ["carry"] = "Carry",
  19.     ["carrz"] = "Carrz",
  20.     ["carid"] = "Carid",
  21.     ["openworld"] = "Openworldmission",
  22.     ["adminlevel"] = "Adminlevel",
  23.     ["firstjoined"] = "Firstjoined",
  24.     ["playtime"] = "Playtime",
  25.     ["shaders"] = "Shaders",
  26. }
  27.  
  28. -- FUNCTIONS --
  29.  
  30.  
  31. sSetting["player_cars"] = {}
  32.  
  33. sFunc["loginPlayer"] = function(thePlayer)
  34.     if(getElementType(thePlayer) == "player") then
  35.         playerData[thePlayer] = {}
  36.         local query = dbQuery(handler, "select * from accounts where Serial = '"..getPlayerSerial(thePlayer).."'")
  37.         local result, numrows = dbPoll(query, dbpTime)
  38.         if(result and numrows > 0) then
  39.             local name = result[1]['Name']
  40.             if(name ~= getPlayerName(thePlayer)) then
  41.                 setPlayerName(thePlayer, name)
  42.             end
  43.             for index, mysqlitem in next, sSetting["aviableDatas"] do
  44.                 local data = result[1][mysqlitem]
  45.                 setPlayerData(thePlayer, index, data, nil)
  46.             end
  47.             spawnJoinPlayer(thePlayer)
  48.            
  49.             -- CAR --
  50.             if not(sSetting["player_cars"][thePlayer]) or not(isElement(sSetting["player_cars"][thePlayer])) then
  51.                 if(tonumber(result[1]['Carid']) ~= 0) then
  52.                     sSetting["player_cars"][thePlayer] = createVehicle(result[1]['Carid'], result[1]['Carx'], result[1]['Cary'], result[1]['Carz'], result[1]['Carrx'], result[1]['Carry'], result[1]['Carrz'])
  53.                     setElementDimension(sSetting["player_cars"][thePlayer], getPlayerData(thePlayer, "id"))
  54.                     setVehicleDamageProof(sSetting["player_cars"][thePlayer], true)
  55.                 end
  56.             end
  57.         else
  58.             kickPlayer(thePlayer, "Console", "Account nicht vorhanden/MySQL Fehler!\nMelde dich bei einem Admin")
  59.         end
  60.     end
  61. end
  62.  
  63. sFunc["registerAccount"] = function(thePlayer)
  64.     local query = dbQuery(handler, "insert into accounts (Name, Serial, IP) values ('"..getPlayerName(thePlayer).."', '"..getPlayerSerial(thePlayer).."', '"..getPlayerIP(thePlayer).."');")
  65.     local result, numrows = dbPoll(query, dbpTime)
  66.     if(result) then
  67.         sFunc["loginPlayer"](thePlayer)
  68.     else
  69.         error("Can't insert account for player "..getPlayerName(thePlayer))
  70.     end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement