Jump to content

Evento "Timed out"


Recommended Posts

Olá amigos, olá amigas. 
estou dando uma "estudada". e estou dando uma atualizada em um "Save-System" meu que tenho aqui.

queria saber sobre o evento "Timed out" se existe uma maneira  de setar os meus dados no "timed out" assim como no "onPlayerQuit"

addEventHandler("onPlayerQuit", getRootElement(), save)


Eu dei uma pequena pesquisada mais não intendi os argumentos sobre "quitType"

eu quero salvar meus "itens" nesses argumentos, principalmente no "timed out"

  • "Unknown"
  • "Quit"
  • "Kicked"
  • "Banned"
  • "Bad Connection"
  • "Timed out" 

parte do meu code
 

function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      local x,y,z = getElementPosition (source)
      local r,g,b = getPlayerNametagColor (source)
      setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source)))
      setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source)))
      setAccountData (account, "funmodev2-health", tostring (getElementHealth (source)))
      setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source)))
      setAccountData (account, "funmodev2-R", r)
      setAccountData (account, "funmodev2-G", g)
      setAccountData (account, "funmodev2-B", b)
      setAccountData (account, "funmodev2-x", x)
      setAccountData (account, "funmodev2-y", y)
      setAccountData (account, "funmodev2-z", z)
      setAccountData (account, "funmodev2-int", getElementInterior (source))
      setAccountData (account, "funmodev2-dim", getElementDimension (source))
      setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source))
      setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0))
      setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1))
      setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2))
      setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3))
      setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4))
      setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5))
      setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6))
      setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7))
      setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, 8))
      setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9))
      setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10))
      setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11))
      setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12))
      setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0))
      setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1))
      setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2))
      setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3))
      setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4))
      setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5))
      setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6))
      setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7))
      setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, 8))
      setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9))
      setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10))
      setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11))
      setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

para falar que não tentei, tentei fazer usando uma "IF".
 

if (reason == "Timed out") then
--code
end

mais não deu certo..

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...