Jump to content

Help


Batista

Recommended Posts

I won't give you the script himself, but the functions/events you can use.

Functions:

getPlayerTeam -- To get the player team. 
getTeamName -- To get the player team name. 
getPlayerAccount -- To get the player account. 
setAccountData -- To save the team name in his account. 
getAccountData -- To get the saved team name in his account. 
getTeamFromName -- To get a team by it's name. 
setPlayerTeam -- To set the player team. 

Events:

[url=https://wiki.multitheftauto.com/wiki/OnPlayerQuit]https://wiki.multitheftauto.com/wiki/OnPlayerQuit[/url] 
[url=https://wiki.multitheftauto.com/wiki/OnPlayerLogin]https://wiki.multitheftauto.com/wiki/OnPlayerLogin[/url] 

Click on the links and start learning.

Edited by Guest
Link to comment
  
addEventHandler("onPlayerQuit",root,function() -- adding on player quit event  
    hisAcc = getPlayerAccount(source) -- get the player account  
    if hisAcc and not isGuestAccount(hisAcc) then -- if he is logged in 
        hisTeam = getPlayerTeam(source) -- get his team 
            if hisTeam then -- if got the team  
                hisTeamName = getTeamName(hisTeam) -- get the team name 
                    setAccountData(hisAcc,"team",hisTeamName) -- save the team in value "team" at his account 
            end 
    end 
end ) 
  
addEventHandler("onPlayerLogin",root,function(_,theCurrentAccount) -- adding on player login event 
    hisAcc = theCurrentAccount  
    hisTeamName = getAccountData(hisAcc,"team") -- get the saved value [ team name ] 
        if hisTeamName then -- if got the value 
            hisTeam = getTeamFromName(hisTeamName) -- get the team from the name saved 
                if hisTeam then -- if got the team 
                    setPlayerTeam(source,hisTeam) -- set his team to the saved team 
                end 
        end 
end ) 
  

Link to comment

well, as long as there are still people around there who will give out full working scripts.. Actually, another way of learning is to get a complete script and trying to understand how everything fits together; and it's rather effective than attempting to create a script from scratch as a newbie

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