Miika Posted October 18, 2014 Share Posted October 18, 2014 My "SaveNameColor" script not working. it does not save color. [server] function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local r, g, b = getPlayerNametagColor ( source ) setAccountData ( playeraccount, "name.color", r, g, b ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local namecolor = getAccountData ( playeraccount, "name.color" ) if ( namecolor ) then setPlayerNametagColor ( source, namecolor ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Anubhav Posted October 18, 2014 Share Posted October 18, 2014 function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local r, g, b = getPlayerNametagColor ( source ) setAccountData ( playeraccount, "name.color", tostring(r)..","..tostring(g)..","..tostring(b) ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local namecolor = getAccountData ( playeraccount, "name.color" ) if ( namecolor ) then local s = split(namecolor, ",") setPlayerNametagColor ( source, s[1], s[2], s[3] ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) 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