BorderLine Posted March 21, 2012 Posted March 21, 2012 i was searching on forum but i didnt find . Is about save team Anyone know why this dont work? debug dont show errors server function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerteam = getPlayerTeam ( source ) setAccountData ( playeraccount, "team", playerteam ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerteam = getAccountData ( playeraccount, "team" ) if ( playerteam ) then setPlayerTeam ( source, playerteam ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Kenix Posted March 21, 2012 Posted March 21, 2012 (edited) You save userdata but should save team name. On quit. getTeamName On login. getTeamFromName Because you save team name string ( in event onPlayerQuit ) and you need get team from string ( in event onPlayerLogin ). function fSaveManager ( ) local uAccount = getPlayerAccount ( source ) if uAccount and not isGuestAccount ( uAccount ) then if eventName == 'onPlayerLogin' then local sTeamName = getAccountData ( uAccount, 'team' ) if sTeamName then setPlayerTeam ( source, getTeamFromName( sTeamName ) ) end elseif eventName == 'onPlayerQuit' then local uTeam = getPlayerTeam( source ) if uTeam then uTeam = getTeamName( uTeam ) end setAccountData ( uAccount, 'team', uTeam ) end end end addEventHandler ( 'onPlayerQuit', root, fSaveManager ) addEventHandler ( 'onPlayerLogin', root, fSaveManager ) Ask questions if you not understand something. Edited March 21, 2012 by Guest http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
BorderLine Posted March 21, 2012 Author Posted March 21, 2012 Perfect can delete script, or thieves will steal thanks a loot bro Actual Nick: [XGN]BorderLine Actual Clan: XLatino Actual Status: Staff, Mod Level 1 (BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline
Kenix Posted March 21, 2012 Posted March 21, 2012 No problem. I do not care whether if stolen. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
TwiX! Posted March 21, 2012 Posted March 21, 2012 Perfect can delete script, or thieves will steal thanks a loot bro u can edit your post - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
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