Akranes123 Posted December 23, 2016 Share Posted December 23, 2016 Hello good morning or night for all, well I am new in scripts but I do not know anything I want to please help me with a script is to save team when the user dies or reconnect and log in your account stay in the team What was before leaving please help me i'm new Link to comment
Simple0x47 Posted December 23, 2016 Share Posted December 23, 2016 (edited) -- SERVER function setTeam( player, team ) -- Use this function to change players team. local acc = getPlayerAccount( player ) local log = isGuestAccount( acc ) if ( player and team ) and not ( log ) then local _team = getTeamFromName( team ) if ( _team ) then setPlayerTeam( player, _team ) setAccountData( acc, "team", _team ) outputChatBox( "Your team has been changed to: " .. team, player, 255, 0, 0 ) end end end function assignTeam( _, a ) if ( a ) then local team = getAccountData( a, "team" ) or nil if ( team ) then setPlayerTeam( source, team ) end end end addEventHandler( "onPlayerLogin", root, assignTeam ) function deathTeam() local acc = getPlayerAccount( source ) local log = isGuestAccount( acc ) if not ( log ) then local team = getAccountData( acc, "team" ) setPlayerTeam( source, team ) end end addEventHandler( "onPlayerWasted", root, deathTeam ) Edited December 23, 2016 by Simple01 Added death team assignament. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now