Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.71 KB | None | 0 0
  1. node = xmlLoadFile ("users.xml")
  2. for i = 0,17 do
  3. texture, model = getPedClothes(source, i)
  4. end
  5.  
  6. function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  7.   if  not (isGuestAccount (getPlayerAccount (source))) then
  8.     local accountData = getAccountData (theCurrentAccount, "xpg.money")
  9.     if (accountData) then
  10.       local pMoney = getAccountData (theCurrentAccount, "xpg.money")
  11.       local pSkin = getAccountData (theCurrentAccount, "xpg.skin")
  12.       local pX = getAccountData (theCurrentAccount, "xpg.x")
  13.       local pY = getAccountData (theCurrentAccount, "xpg.y")
  14.       local pZ = getAccountData (theCurrentAccount, "xpg.z")
  15.       local pInt = getAccountData (theCurrentAccount, "xpg.int")
  16.       local pDim = getAccountData (theCurrentAccount, "xpg.dim")
  17.       local pCl = getAccountData (theCurrentAccount, "xpg.cl".tostring(i))
  18.       local pWeaponID = getAccountData (theCurrentAccount, "xpg.weaponID")
  19.       local pWeaponAmmo = getAccountData (theCurrentAccount, "xpg.weaponAmmo")
  20.       spawnPlayer (source, pX, pY, pZ + 1, 0, pSkin, pInt, pDim, pCl)
  21.       setPlayerMoney (source, pMoney)
  22.       setTimer (giveWeapon, 500, 1, source, pWeaponID, pWeaponAmmo, true)
  23.       setCameraTarget (source, source)
  24.       fadeCamera(source, true, 2.0)
  25.     else
  26.       spawnPlayer (source, 2000.55, 1526.25, 14.6171875, 0, 0, 0, 0)
  27.       setPlayerMoney (source, 0)
  28.       setCameraTarget (source, source)
  29.       fadeCamera(source, true, 2.0)
  30.       setPlayerNameTagColor(source, math.random(0,255), math.random(0,255), math.random(0,255))
  31.     end  
  32.   end
  33. end
  34. addEventHandler ("onPlayerLogin", getRootElement(), playerLogin)
  35.  
  36. function onLogout ()
  37.     kickPlayer (source, nil, "Logging out is disallowed.")
  38. end
  39. addEventHandler ("onPlayerLogout", getRootElement(), onLogout)
  40.  
  41. function onQuit (quitType, reason, responsibleElement)
  42.   if not (isGuestAccount (getPlayerAccount (source))) then
  43.     account = getPlayerAccount (source)
  44.     if (account) then
  45.       local x,y,z = getElementPosition (source)
  46.       setAccountData (account, "xpg.money", tostring (getPlayerMoney (source)))
  47.       setAccountData (account, "xpg.skin", tostring (getPedSkin (source)))
  48.       setAccountData (account, "xpg.x", x)
  49.       setAccountData (account, "xpg.y", y)
  50.       setAccountData (account, "xpg.z", z)
  51.       setAccountData (account, "xpg.int", getElementInterior (source))
  52.       setAccountData (account, "xpg.dim", getElementDimension (source))
  53.       setAccountData (account, "xpg.cl".tostring(i), (texture and model))
  54.       setAccountData (account, "xpg.wantedID", getPlayerWeapon (source))
  55.       setAccountData (account, "xpg.wantedAmmo", getPlayerTotalAmmo (source))
  56.       end
  57.     end
  58. end
  59. addEventHandler ("onPlayerQuit", getRootElement(), onQuit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement