Jump to content

Save player team


roy_ppp

Recommended Posts

Posted

first this is not a requesting forum and second you should check out the wiki but anyway i've made it for you this time, i hope it works i didn't had time to test it.

server.lua:

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

meta.xml:

<meta> 
    <info author="Castillo" version="1.0.0" type="script"  
    description="team saver when quit/logout" /> 
    <script src="server.lua" type="server"/> 
</meta> 

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.

Posted

Solid, I'm wondering why are you so often giving full script instead of direct someone how to make/fix it.. I'm not saying if it's bad or not.. Just thinking..

Also, there was a lot of topics like this one. I think little searching can bring the answer.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted
Solid, I'm wondering why are you so often giving full script instead of direct someone how to make/fix it.. I'm not saying if it's bad or not.. Just thinking..

Also, there was a lot of topics like this one. I think little searching can bring the answer.

I know about this, i was just too lazy to explain it etc so just made the script, next time i will not post whole code ;)

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.

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...