Jump to content

Pregunta sobre "setAccountData"


Serginix

Recommended Posts

Posted

Holas,

taba haciendo un resouce q guarde cosas como tu dinero la vida y esas mamadas, pero al intentar hacer q me guarde, expecificamente el Equipo, No me funciona, mas sin embargo el resto si, la extructura del setAccountData, seria :

function onQuit (quitType, reason, responsibleElement) 
  if not (isGuestAccount (getPlayerAccount (source))) then 
    account = getPlayerAccount (source) 
    if (account) then 
      setAccountData (account, "equipo", getPlayerTeam ( source )) 
    end 
  end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onQuit) 

Ok, Todo bien, omiti las otras cosas,

Al Logearse seria:

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
  if  not (isGuestAccount (getPlayerAccount (source))) then 
    local accountData = getAccountData (theCurrentAccount, "equipo") 
    if (accountData) then 
      local equipo = getAccountData (theCurrentAccount, "equipo") 
            setPlayerTeam (source, equipo) 
   end 
  end 
end 
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) 

La vdd, ya mire la wiki :(https://wiki.multitheftauto.com/wiki/GetPlayerTeam) y no se odnde fallo =S...

gracias por su tiempo...

n-560x95_FFFFFF_FFFFFF_000000_000000.png

"Proyecto SX" Owner :P

Posted

Mira, lo que tenes que hacer es guardar el nombre del equipo, no el elemento.

function onQuit (quitType, reason, responsibleElement) 
  if not (isGuestAccount (getPlayerAccount (source))) then 
    account = getPlayerAccount (source) 
    if (account) then 
      setAccountData (account, "equipo", getTeamName(getPlayerTeam ( source ))) 
    end 
  end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onQuit) 
  
function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
  if  not (isGuestAccount (getPlayerAccount (source))) then 
    local accountData = getAccountData (theCurrentAccount, "equipo") 
    if (accountData) then 
      local equipo = getAccountData (theCurrentAccount, "equipo") 
            setPlayerTeam (source, getTeamFromName(equipo)) 
   end 
  end 
end 
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Recently Browsing   0 members

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