Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.33 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)
  60.  
  61. function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth)
  62.   if not( isGuestAccount (getPlayerAccount(source)) ) then
  63.     local theWeapon = getPlayerWeapon (source)
  64.     local weaponAmmo = getPlayerTotalAmmo (source)
  65.     fadeCamera (source, false)
  66.     setTimer (spawnPlayer, 1000, 1, source, 1607.35, 1816.54, 10.82, 0, getPedSkin (source), 0, 0, spawnTeam)
  67.     setTimer (setCameraTarget, 1250, 1, source, source)
  68.     setTimer (fadeCamera, 2000, 1, source, true)
  69.     setTimer (giveWeapon, 2000, 1, source, theWeapon, weaponAmmo, true)
  70.   end
  71. end
  72. addEventHandler ("onPlayerWasted", getRootElement(), onWasted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement